Skip to content

Commit

Permalink
Merge fe69312 into d5fd52c
Browse files Browse the repository at this point in the history
  • Loading branch information
learninglincoln committed Feb 27, 2020
2 parents d5fd52c + fe69312 commit 51d3991
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
28 changes: 22 additions & 6 deletions tests/test_catmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,34 @@


def test__cat_years_to_hooman_years__middle_age__succeeds():
assert True
cat_age = 10
hooman_age = catmath.cat_years_to_hooman_years(cat_age)
assert hooman_age == 50


def test__cat_years_to_hooman_years__less_than_one_year__succeeds():
assert True
cat_age = 0.5
hooman_age = catmath.cat_years_to_hooman_years(cat_age)
assert hooman_age == 2.5


def test__cat_years_to_hooman_years__0__returns_0():
assert True
cat_age = 0
hooman_age = catmath.cat_years_to_hooman_years(cat_age)
assert hooman_age == 0


# BONUS MATERIAL FOR STEP 2
def test_felipe():
assert catmath.is_cat_leap_year(5) is False

def test__is_cat_leap_year__succeeds():
assert catmath.is_cat_leap_year(2016) is True

def test_benicio():
assert catmath.is_cat_leap_year(104) is True


def test_maiara():
assert catmath.is_cat_leap_year(500) is False


def test_final():
assert catmath.is_cat_leap_year(400) is True
16 changes: 10 additions & 6 deletions tests/test_safecatmath.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# import pytest
import pytest

from catinabox import safecatmath

Expand All @@ -19,17 +19,21 @@ def test__cat_years_to_hooman_years__0__returns_0():


def test__cat_years_to_hooman_years__less_0__raises():
assert True
with pytest.raises(safecatmath.InvalidAge):
safecatmath.cat_years_to_hooman_years(-4)


def test__cat_years_to_hooman_years__older_than_1000__raises():
assert True
with pytest.raises(safecatmath.InvalidAge):
safecatmath.cat_years_to_hooman_years(4404)


def test__cat_years_to_hooman_years__string__raises():
assert True
with pytest.raises(safecatmath.InvalidAge):
safecatmath.cat_years_to_hooman_years("oi")


def test__cat_years_to_hooman_years__nan__raises():
# hooman_age = float('nan')
assert True
hooman_age = float('nan')
with pytest.raises(safecatmath.InvalidAge):
safecatmath.cat_years_to_hooman_years(hooman_age)

0 comments on commit 51d3991

Please sign in to comment.