def test_sound_horn_when_truck_engine_stoped_and_return_start_engine_to_sound_horn( capfd): # Arrange truck = Truck(color='Blue', max_speed=5, acceleration=4, tyre_friction=3, max_cargo_weight=1) start_engine_to_sound = "Start the engine to sound_horn\n" # Act truck.sound_horn() output = capfd.readouterr() # Assert assert output.out == start_engine_to_sound
def test_sound_horn_when_truck_engine_started_and_return_car_sound(capfd): # Arrange truck = Truck(color='Blue', max_speed=5, acceleration=4, tyre_friction=3, max_cargo_weight=1) truck.start_engine() sound = "Honk Honk\n" # Act truck.sound_horn() output = capfd.readouterr() # Assert assert output.out == sound