Exemplo n.º 1
0
def test_load_cargo_when_truck_is_stopped_and_current_speed_is_zero_returns_current_cargo_weight(
):
    # Arrange
    truck = Truck(color="Red",
                  max_speed=50,
                  acceleration=10,
                  tyre_friction=30,
                  max_cargo_weight=100)
    truck.start_engine()
    current_cargo_weight = 50

    # Act
    truck.stop_engine()
    truck.load(50)

    # Assert
    assert truck.current_cargo_weight == current_cargo_weight
Exemplo n.º 2
0
def test_load_cargo_when_truck_is_stopped_and_current_speed_is_not_zero_returns_statement(
        capsys):
    # Arrange
    truck = Truck(color="Red",
                  max_speed=50,
                  acceleration=10,
                  tyre_friction=30,
                  max_cargo_weight=100)
    truck.start_engine()
    truck.accelerate()
    statement = "Cannot load cargo during motion\n"

    # Act
    truck.stop_engine()
    truck.load(50)
    captured = capsys.readouterr()

    # Assert
    assert captured.out == statement