def test__cat_years_to_hooman_years__0__returns_0():
    hooman_age = safecatmath.cat_years_to_hooman_years(0)
    assert hooman_age == 0
Example #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
Example #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
Example #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')
Example #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
Example #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
def test__cat_years_to_hooman_years__older_than_1000__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(1001)
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years('abc')
def test__cat_years_to_hooman_years__less_0__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(-1)
def test__cat_years_to_hooman_years__0__returns_0():
    hooman_age = safecatmath.cat_years_to_hooman_years(0)
    assert hooman_age == 0
def test__cat_years_to_hooman_years__string__raises():
    import pytest
    with pytest.raises(InvalidAge):
        safecatmath.cat_years_to_hooman_years("six")
def test__cat_years_to_hooman_years__less_0__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(-1)
Example #16
0
def test__cat_years_to_hooman(age, expected):
    assert safecatmath.cat_years_to_hooman_years(age) == expected
def test__cat_years_to_hooman_years__older_than_1000__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(1001)
Example #18
0
def test__cat_years_to_hooman_invalid(age):
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(age)
def test__cat_years_to_hooman_years__middle_age__succeeds():
    hooman_age = safecatmath.cat_years_to_hooman_years(7)
    assert hooman_age == 35
Example #20
0
def test__cat_years_to_hooman_years__nan__raises():
    with pytest.raises(InvalidAge):
        safecatmath.cat_years_to_hooman_years(float('nan'))