Ejemplo n.º 1
0
    def test_leave_multi_car(self):
        #prepare
        park = Park(5)
        park.park = [
            Car('xxx', 'red'),
            Car('yyy', 'blue'),
            Car('zzz', 'green'),
            Car('aaa', 'blue'),
            Car('bbb', 'red')
        ]
        expectedPark = [
            None, Car('yyy', 'blue'),
            Car('zzz', 'green'), None, None
        ]

        #execute
        park.leaveCar(1)
        park.leaveCar(4)
        park.leaveCar(5)

        #assert
        self.equalPark(park.park, expectedPark)
Ejemplo n.º 2
0
 def createPark(self, slotNumber):
     s = int(slotNumber)
     self.park = Park(s)
     output.createdPark(s)
Ejemplo n.º 3
0
 def test_create_park(self):
     park = Park(3)
     expectPark = [None] * 3
     self.assertEqual(park.park, expectPark)
Ejemplo n.º 4
0
    def test_park_and_leave(self):
        #prepare
        park = Park(5)
        expectedPark = [
            Car('bbb', 'red'),
            Car('yyy', 'blue'), None,
            Car('aaa', 'blue'), None
        ]

        #execute
        park.addCar(Car('xxx', 'red'))
        park.addCar(Car('yyy', 'blue'))
        park.addCar(Car('zzz', 'green'))
        park.addCar(Car('aaa', 'blue'))
        park.leaveCar(1)
        park.leaveCar(3)
        park.addCar(Car('bbb', 'red'))

        #assert
        self.equalPark(park.park, expectedPark)