Skip to content

Commit f22c88f

Browse files
author
fkromer
committed
add: test for cat and dog class
1 parent d3b9b5f commit f22c88f

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

test_abstract_factory.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from unittest.mock import patch
1313

14+
1415
class TestPetShop(unittest.TestCase):
1516

1617
def test_dog_pet_shop_shall_show_dog_instance(self):
@@ -31,6 +32,33 @@ def test_cat_pet_shop_shall_show_cat_instance(self):
3132
self.assertEqual(mock_f_get_pet.call_count, 1)
3233
self.assertEqual(mock_f_get_food.call_count, 1)
3334

35+
36+
class TestCat(unittest.TestCase):
37+
38+
@classmethod
39+
def setUpClass(cls):
40+
cls.c = Cat()
41+
42+
def test_cat_shall_meow(cls):
43+
cls.assertEqual(cls.c.speak(), 'meow')
44+
45+
def test_cat_shall_be_printable(cls):
46+
cls.assertEqual(str(cls.c), 'Cat')
47+
48+
49+
class TestDog(unittest.TestCase):
50+
51+
@classmethod
52+
def setUpClass(cls):
53+
cls.d = Dog()
54+
55+
def test_dog_shall_woof(cls):
56+
cls.assertEqual(cls.d.speak(), 'woof')
57+
58+
def test_dog_shall_be_printable(cls):
59+
cls.assertEqual(str(cls.d), 'Dog')
60+
61+
3462
if __name__ == "__main__":
3563
unittest.main()
3664

0 commit comments

Comments
 (0)