Пример #1
0
def test__cat_years_to_hooman_years__0__returns_0():
    hooman_age = safecatmath.cat_years_to_hooman_years(0)
    assert hooman_age == 0
Пример #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)
Пример #3
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
Пример #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
Пример #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)
Пример #6
0
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years('foo')
Пример #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')
Пример #8
0
def test__cat_years_to_hooman_years__middle_age__succeeds():
    hooman_age = safecatmath.cat_years_to_hooman_years(7)
    assert hooman_age == 35
Пример #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
Пример #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)
Пример #11
0
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years('abc')
Пример #12
0
def test__cat_years_to_hooman_years__less_0__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(-1)
Пример #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
Пример #14
0
def test__cat_years_to_hooman_years__string__raises():
    import pytest
    with pytest.raises(InvalidAge):
        safecatmath.cat_years_to_hooman_years("six")
Пример #15
0
def test__cat_years_to_hooman_years__less_0__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(-1)
Пример #16
0
def test__cat_years_to_hooman(age, expected):
    assert safecatmath.cat_years_to_hooman_years(age) == expected
Пример #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)
Пример #18
0
def test__cat_years_to_hooman_invalid(age):
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(age)
Пример #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
Пример #20
0
def test__cat_years_to_hooman_years__nan__raises():
    with pytest.raises(InvalidAge):
        safecatmath.cat_years_to_hooman_years(float('nan'))