def test_slotNumber(self): """ test slot Number of car check output after insert and delete to be excepted """ oParking = Parking(2) sMessage = oParking.carsWithColor("white") self.assertEquals("", "") oParking.addCar("12", "white") sMessage = oParking.slotNumber("12") self.assertEquals(sMessage, "1") oParking.addCar("13", "black") sMessage = oParking.slotNumber("12") self.assertEquals(sMessage, "1") oParking.removeCar(1) sMessage = oParking.slotNumber("12") self.assertEquals(sMessage, "None Found") sMessage = oParking.slotNumber("13") self.assertEquals(sMessage, "2")
input_file = open(sys.argv[1], 'r') getCommand = input_file.readline else: getCommand = raw_input if bInteractive: print "Input:" sCommand = getCommand() while sCommand: lCommands = sCommand.split() iLength = len(lCommands) if iLength: if bInteractive: print "\nOutput:" if lCommands[0] == "create_parking_lot" and iLength == 2: oParking = Parking(int(lCommands[1])) elif lCommands[0] == "park" and iLength == 3: print oParking.addCar(lCommands[1], lCommands[2]) + "\n" elif lCommands[0] == "leave" and iLength == 2: print oParking.removeCar(int(lCommands[1])) + "\n" elif lCommands[0] == "status": print oParking.status() elif lCommands[ 0] == "registration_numbers_for_cars_with_colour" and iLength == 2: print oParking.carsWithColor(lCommands[1]) + "\n" elif lCommands[ 0] == "slot_number_for_registration_number" and iLength == 2: print oParking.slotNumber(lCommands[1]) + "\n" if bInteractive: print "Input:" sCommand = getCommand()