Exemple #1
0
def test_car_drive():
    car = Car()
    car.refill(60)
    car.drive(0, 0)
    assert round(car.fuel_amount, 2) == 60.00
    assert car.location == Point(0, 0)

    car.drive(2, 2)
    assert round(car.fuel_amount, 2) == 58.30
    assert car.location == Point(2, 2)
Exemple #2
0
def test_car_refill_exception(value, exception_type):
    car = Car()
    car.refill(30)

    with pytest.raises(exception_type):
        car.refill(value)
Exemple #3
0
def test_fill():
    point1 = Point(4, 4)
    car1 = Car(30, 90, 10, point1, "MAzda")
    car1.refill(10)
    assert car1.fuel_amount == 40
Exemple #4
0
def test_car_refill(actual, expected):
    car = Car()
    car.refill(30)
    car.refill(actual)
    assert car.fuel_amount == expected
Exemple #5
0
def test_check_refill_exception():
    point = Point(4, 4)
    car = Car(30, 90, 10, point, "MAzda")
    with pytest.raises(ToMuchFuel):
        car.refill(100)