def test_leave_slot_free(self):
     parkingLot = create_parking_lot(str(6))
     park_car(parkingLot, 'PB-01-HH-1234', '21')
     testResponse = leave_slot(parkingLot, '1')
     self.assertEqual('Slot number 1 vacated, the car with vehicle '\
         'registration number "PB-01-HH-1234" left the space, '\
         'the driver of the car was of age 21', testResponse)
Ejemplo n.º 2
0
def executeCommand(parkingLot, command):
    if command[0] == 'Create_parking_lot':
        parkingLot = create_parking_lot(command[1])
    elif command[0] == 'Park':
        print(park_car(parkingLot, command[1], command[3]))
    elif command[0] == 'Leave':
        print(leave_slot(parkingLot, command[1]))
    elif command[0] == 'Slot_numbers_for_driver_of_age':
        print(get_slots_with_driver_age(parkingLot, command[1]))
    elif command[0] == 'Slot_number_for_car_with_number':
        print(get_slot_by_car_registration(parkingLot, command[1]))
    elif command[0] == 'Vehicle_registration_number_for_driver_of_age':
        print(get_vehical_regno_for_driver(parkingLot, command[1]))
    else:
        print('Undefined command!')
    return parkingLot
 def test_leave_slot_not_defined(self):
     testResponse = leave_slot(None, '1')
     self.assertEqual('Parking lot has not been created yet!', testResponse)
 def test_leave_slot_unoccupied(self):
     parkingLot = create_parking_lot(str(6))
     park_car(parkingLot, 'PB-01-HH-1234', '27')
     testResponse = leave_slot(parkingLot, '2')
     self.assertEqual('No car found this in this slot!', testResponse)
 def test_leave_slot_cannot_exit(self):
     parkingLot = create_parking_lot(str(6))
     park_car(parkingLot, 'PB-01-HH-1234', '27')
     testResponse = leave_slot(parkingLot, '7')
     self.assertEqual('No such lot exists!', testResponse)
 def test_leave_slot_empty(self):
     parkingLot = create_parking_lot(str(6))
     testResponse = leave_slot(parkingLot, '1')
     self.assertEqual('No car found this in this slot!', testResponse)