Ejemplo n.º 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
Ejemplo 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)
Ejemplo n.º 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
Ejemplo 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
Ejemplo 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)
Ejemplo n.º 6
0
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years('foo')
Ejemplo 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')
Ejemplo n.º 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
Ejemplo 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
Ejemplo 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)
Ejemplo n.º 11
0
def test__cat_years_to_hooman_years__string__raises():
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years('abc')
Ejemplo 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)
Ejemplo 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
Ejemplo 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")
Ejemplo 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)
Ejemplo n.º 16
0
def test__cat_years_to_hooman(age, expected):
    assert safecatmath.cat_years_to_hooman_years(age) == expected
Ejemplo 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)
Ejemplo n.º 18
0
def test__cat_years_to_hooman_invalid(age):
    with pytest.raises(safecatmath.InvalidAge):
        safecatmath.cat_years_to_hooman_years(age)
Ejemplo 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
Ejemplo n.º 20
0
def test__cat_years_to_hooman_years__nan__raises():
    with pytest.raises(InvalidAge):
        safecatmath.cat_years_to_hooman_years(float('nan'))