示例#1
0
def test_car_drive_to_point():
    car = Car()
    car.refill(60)
    car.drive_to_point(Point(0, 0))
    assert round(car.fuel_amount, 2) == 60.00
    assert car.location == Point(0, 0)

    car.drive_to_point(Point(2, 2))
    assert round(car.fuel_amount, 2) == 58.30
    assert car.location == Point(2, 2)
示例#2
0
def test_car_drive_to_point_exception(value, exception_type):
    car = Car()

    with pytest.raises(exception_type):
        car.drive_to_point(value)