File size: 449 Bytes
db7ff99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import pytest


def validate_input(age: int, income: float):
    if age < 0:
        raise ValueError("Age must be positive")
    if income <= 0:
        raise ValueError("Income must be positive")
    return True


def test_negative_age_raises_error():
    with pytest.raises(ValueError):
        validate_input(age=-5, income=1000)


def test_zero_income_raises_error():
    with pytest.raises(ValueError):
        validate_input(age=30, income=0)