예제 #1
0
    def test_find_slot_number_with_colour_not_found(self):
        #prepare
        park = Park(5)
        park.park = [
            Car('xxx', 'red'),
            Car('yyy', 'blue'),
            Car('zzz', 'green'),
            Car('aaa', 'blue'),
            Car('bbb', 'red')
        ]
        expectedSlotNumbers = []

        #execute
        regNumbers = park.findSlotNumberWithColor('white')

        #assert
        self.assertListEqual(regNumbers, expectedSlotNumbers)
예제 #2
0
    def test_find_slot_number_with_reg_number(self):
        #prepare
        park = Park(5)
        park.park = [
            Car('xxx', 'red'),
            Car('yyy', 'blue'),
            Car('zzz', 'green'),
            Car('aaa', 'blue'),
            Car('bbb', 'red')
        ]
        expectedSlotNumbers = ['2']

        #execute
        regNumbers = park.findSlotNumberWithRegNumber('yyy')

        #assert
        self.assertListEqual(regNumbers, expectedSlotNumbers)
예제 #3
0
    def test_find_reg_number_with_colour_multi(self):
        #prepare
        park = Park(5)
        park.park = [
            Car('xxx', 'red'),
            Car('yyy', 'blue'),
            Car('zzz', 'green'),
            Car('aaa', 'blue'),
            Car('bbb', 'red')
        ]
        expectedRegNumbers = ['xxx', 'bbb']

        #execute
        regNumbers = park.findRegNumberWithColor('red')

        #assert
        self.assertListEqual(regNumbers, expectedRegNumbers)
예제 #4
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)