def test_travel_set_negative_value_to_car_property(default_travel: Travel): """ Test case for incorrect Travel.car_price method use TEST CASE: Calling car_price method to set a negative car price. EXPECTED BEHAVIOUR: The method raise a ValueError exception because the price is negative. """ with pytest.raises(ValueError): default_travel.car_price = -1.0
def test_travel_car_price_set_wrong_type(default_travel: Travel): """ Test case for incorrect Travel.car_price method use TEST CASE: Calling car_price method to set non float car price. EXPECTED BEHAVIOUR: The method raise a TypeError exception because the price is non float. """ with pytest.raises(TypeError): default_travel.car_price = 5
def test_travel_set_positive_value_to_car_property(default_travel: Travel): """ Test case for Travel.car_price and Travel._car_price methods TEST CASE: Calling car_price method to set a car price and _car_price to get that price. EXPECTED BEHAVIOUR: The methods set and get the prices for a car correctly. """ default_travel.car_price = 5.0 assert default_travel._car_price != 0.0 assert default_travel._car_price == 5.0
def test_travel_cost_cars(default_travel: Travel, default_cars): """ Test case for Travel.cost method with Flights and Cars TEST CASE: Calling cost method to check the total cost with only an instances of Flights and Cars EXPECTED BEHAVIOUR: The method returns only the sum of flights cost and cars cost. """ default_travel.ticket_price = MOCKED_TICKET_PRICE default_travel.car_price = MOCKED_CAR_PRICE default_travel._cars = default_cars assert default_travel.cost == DEFAULT_FLIGHT_TOTAL_COST + DEFAULT_CAR_TOTAL_COST