示例#1
0
 def test_diesel_car_fuel_cylinders(self):
     diesel_car = DieselCar()
     self.assertEqual(1, diesel_car.getNumberCylinders())
     diesel_car.setNumberCylinders(4)
     self.assertEqual(4, diesel_car.getNumberCylinders())
示例#2
0
carP = PetrolCar()
carP.setMake("Volkswagen Beetle")
carP.setColour("Blue")
carP.setNumberCylinders(4)
carP.setMileage(1000)
print " Make of Petrol car is      :" + carP.getMake()
print " Colour of the car is       :" + carP.getColour()
print " Number of cylinders        :" + str(carP.getNumberCylinders())
print " Mileage of Petrol car is   :" + str(carP.getMileage())
print "_________________________________________"

#Diesel car details.
carD = DieselCar()
carD.setMake("Audi Q7")
carD.setColour("Silver")
carD.setNumberCylinders(4)
carD.setMileage(500)
print " Make of Diesel car is      :" + carD.getMake()
print " Colour of the car is       :" + carD.getColour()
print " Number of cylinders        :" + str(carD.getNumberCylinders())
print " Milegae of Diesel car is   :" + str(carD.getMileage())
print "_________________________________________"

#Electric car details.
carE = ElectricCar()
carE.setMake("Nissan Leaf")
carE.setColour("Green")
carE.setNumberFuelCells(4)
carE.setMileage(450)
print " Make of Electric car is    :" + carE.getMake()
print " Colour of the car is       :" + carE.getColour()