def test__cat_years_to_hooman_years__0__returns_0():
    hooman_age = safecatmath.cat_years_to_hooman_years(0)
    assert hooman_age == 0
Esempio n. 2
0
def test__cat_years_to_hooman_years__nan__raises():
    hooman_age = float('nan')
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(hooman_age)
def test__cat_years_to_hooman_years__less_than_one_year__succeeds():
    hooman_age = safecatmath.cat_years_to_hooman_years(0.1)
    assert hooman_age == 0.5
Esempio n. 4
0
def test__cat_years_to_hooman_years__middle_age__succeeds(age, expected):
    hooman_age = safecatmath.cat_years_to_hooman_years(age)
    assert hooman_age == expected
Esempio n. 5
0
def test__cat_years_to_hooman_years__older_than_MAX_CAT_AGE__raises():
    too_old = safecatmath.MAX_CAT_AGE + 1
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(too_old)
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years('foo')
Esempio n. 7
0
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAgeError):
        safecatmath.cat_years_to_hooman_years('cat age in years')
def test__cat_years_to_hooman_years__middle_age__succeeds():
    hooman_age = safecatmath.cat_years_to_hooman_years(7)
    assert hooman_age == 35
Esempio n. 9
0
def test__cat_years_to_hooman_years__less_than_one_year__succeeds():
    hooman_age = safecatmath.cat_years_to_hooman_years(0.1)
    assert hooman_age == 0.5
Esempio n. 10
0
def test__cat_years_to_hooman_years__older_than_1000__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(1001)
Esempio n. 11
0
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years('abc')
Esempio n. 12
0
def test__cat_years_to_hooman_years__less_0__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(-1)
Esempio n. 13
0
def test__cat_years_to_hooman_years__0__returns_0():
    hooman_age = safecatmath.cat_years_to_hooman_years(0)
    assert hooman_age == 0
Esempio n. 14
0
def test__cat_years_to_hooman_years__string__raises():
    import pytest
    with pytest.raises(InvalidAge):
        safecatmath.cat_years_to_hooman_years("six")
Esempio n. 15
0
def test__cat_years_to_hooman_years__less_0__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(-1)
Esempio n. 16
0
def test__cat_years_to_hooman(age, expected):
    assert safecatmath.cat_years_to_hooman_years(age) == expected
Esempio n. 17
0
def test__cat_years_to_hooman_years__older_than_1000__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(1001)
Esempio n. 18
0
def test__cat_years_to_hooman_invalid(age):
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(age)
Esempio n. 19
0
def test__cat_years_to_hooman_years__middle_age__succeeds():
    hooman_age = safecatmath.cat_years_to_hooman_years(7)
    assert hooman_age == 35
Esempio n. 20
0
def test__cat_years_to_hooman_years__nan__raises():
    with pytest.raises(InvalidAge):
        safecatmath.cat_years_to_hooman_years(float('nan'))