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_check_drive_exception():
    point1 = Point(4, 4)
    point2 = Point(555, 555)
    car1 = Car(30, 90, 10, point1, "MAzda")
    with pytest.raises(OutOfFuel):
        car1.drive(point2)
Exemple #3
0
def test_drive():
    point1 = Point(4, 4)
    point2 = Point(5, 5)
    car1 = Car(30, 90, 10, point1, "MAzda")
    car1.drive(point2)
    assert car1.location == point2