Пример #1
0
    def test_should_parking_car_to_the_lot_whose_available_space_rate_is_largest(
            self):
        # 7/10 < 4/5
        first_parking_lot = ParkingLot(10)
        first_parking_lot.park(Car())
        first_parking_lot.park(Car())
        first_parking_lot.park(Car())
        second_parking_lot = ParkingLot(5)
        second_parking_lot.park(Car())

        car = Car()
        parking_boy = SuperParkingBoy([first_parking_lot, second_parking_lot])

        parking_boy.park(car)

        self.assertEqual(first_parking_lot.get_available_space_count(), 7)
        self.assertEqual(second_parking_lot.get_available_space_count(), 3)
Пример #2
0
    def test_should_parking_car_to_the_lot_whose_available_space_size_is_largest(
            self):
        first_parking_lot = ParkingLot(1)
        second_parking_lot = ParkingLot(2)
        car = Car()
        parking_boy = SmartParkingBoy([first_parking_lot, second_parking_lot])

        parking_boy.park(car)

        self.assertFalse(first_parking_lot.is_full())
        self.assertEqual(second_parking_lot.get_available_space_count(), 1)