Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/test_catmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@


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


def test__cat_years_to_hooman_years__less_than_one_year__succeeds():
assert True
assert catmath.cat_years_to_hooman_years(0.2) == 1


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


# BONUS MATERIAL FOR STEP 2
Expand Down
21 changes: 13 additions & 8 deletions tests/test_cattery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
from catinabox import cattery


@pytest.fixture()
def cattery_fix():
return cattery.Cattery()


###########################################################################
# add_cats
###########################################################################

def test__add_cats__succeeds():
c = cattery.Cattery()
def test__add_cats__succeeds(cattery_fix):
c = cattery_fix
c.add_cats(["Fluffy", "Snookums"])
assert c.cats == ["Fluffy", "Snookums"]
assert c.num_cats == 2
Expand All @@ -18,22 +23,22 @@ def test__add_cats__succeeds():
# remove_cat
###########################################################################

def test__remove_cat__succeeds():
c = cattery.Cattery()
def test__remove_cat__succeeds(cattery_fix):
c = cattery_fix
c.add_cats(["Fluffy", "Junior"])
c.remove_cat("Fluffy")
assert c.cats == ["Junior"]
assert c.num_cats == 1


def test__remove_cat__no_cats__fails():
c = cattery.Cattery()
def test__remove_cat__no_cats__fails(cattery_fix):
c = cattery_fix
with pytest.raises(cattery.CatNotFound):
c.remove_cat("Fluffles")


def test__remove_cat__cat_not_in_cattery__fails():
c = cattery.Cattery()
def test__remove_cat__cat_not_in_cattery__fails(cattery_fix):
c = cattery_fix
c.add_cats(["Fluffy"])
with pytest.raises(cattery.CatNotFound):
c.remove_cat("Snookums")
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(-10)


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


def test__cat_years_to_hooman_years__string__raises():
assert True
with pytest.raises(safecatmath.InvalidAge):
safecatmath.cat_years_to_hooman_years('3000')


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)