예제 #1
0
 def test_drive__when_fuel_needed_equal_to_amount__should_be_zero(self):
     car_manager = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity)
     car_manager.fuel_amount = 5
     car_manager.drive(500)
     expected = 0
     self.assertEqual(expected, car_manager.fuel_amount)
예제 #2
0
 def test_drive__when_fuel_needed_more_than_amount__should_raise_exception(self):
     car_manager = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity)
     car_manager.fuel_amount = 7
     with self.assertRaises(Exception):
         car_manager.drive(5000)
예제 #3
0
 def test_drive__when_fuel_needed_less_than_amount__should_decrease(self):
     car_manager = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity)
     car_manager.fuel_amount = 7
     car_manager.drive(500)
     expected = 2
     self.assertEqual(expected, car_manager.fuel_amount)