forked from faif/python-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_builder.py
More file actions
34 lines (24 loc) · 986 Bytes
/
test_builder.py
File metadata and controls
34 lines (24 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from creational.builder import Director, BuilderHouse, BuilderFlat
class TestHouseBuilding(unittest.TestCase):
def setUp(self):
self.director = Director()
self.director.builder = BuilderHouse()
self.director.construct_building()
self.building = self.director.get_building()
def test_house_size(self):
self.assertEqual(self.building.size, 'Big')
def test_num_floor_in_house(self):
self.assertEqual(self.building.floor, 'One')
class TestFlatBuilding(unittest.TestCase):
def setUp(self):
self.director = Director()
self.director.builder = BuilderFlat()
self.director.construct_building()
self.building = self.director.get_building()
def test_house_size(self):
self.assertEqual(self.building.size, 'Small')
def test_num_floor_in_house(self):
self.assertEqual(self.building.floor, 'More than One')