Example #1
0
class StreetGridTests(unittest.TestCase):
    def setUp(self):
        self.sts_EW_1 = ['A', 'B', 'C']
        self.sts_NS_1 = ['1', '2', '3', '4']
        self.grid_from_sts = StreetGrid(self.sts_NS_1, self.sts_EW_1)

        self.height = 5
        self.width = 3
        self.grid_from_static = StreetGrid.with_dimensions(self.width, self.height)

    def test_should_get_height_width(self):
        self.assertEqual(self.grid_from_sts.height(), 3)
        self.assertEqual(self.grid_from_sts.width(), 4)

        self.assertEqual(self.grid_from_static.height(), self.height)
        self.assertEqual(self.grid_from_static.width(), self.width)

    def test_should_get_intersection(self):
        intersection = self.grid_from_sts.get_intersection(2, 1)
        self.assertEquals(intersection, Intersection('B','1'))

# TODO: add negative cases for get
    def test_should_get_street(self):
        st1 = self.grid_from_sts.get_EW_st(2)
        st2 = self.grid_from_sts.get_NS_st(3)
        self.assertEqual(st1, 'B')
        self.assertEqual(st2, '3')
Example #2
0
    def setUp(self):
        self.sts_EW_1 = ['A', 'B', 'C']
        self.sts_NS_1 = ['1', '2', '3', '4']
        self.grid_from_sts = StreetGrid(self.sts_NS_1, self.sts_EW_1)

        self.height = 5
        self.width = 3
        self.grid_from_static = StreetGrid.with_dimensions(self.width, self.height)
Example #3
0
 def setUp(self):
     self.grid = StreetGrid.with_dimensions(5, 5)