def test_natural_numbers(): with pytest.raises(ValueError): mph(-1) with pytest.raises(ValueError): mph(2.4) with pytest.raises(ValueError): mph("three hedgehogs in a trenchcoat")
def test_takes_two_to_row(): assert mph(2) > mph(1), "2 passengers should row faster than 1"
def test_passengers_slow_us_down(): assert mph(4) < mph(2), "4 passengers should row slower than 2"
def test_exact_speed(): assert mph(2) == 3 - (2 / 3)
def test_no_rowers_no_motion(): assert mph(0) == 0, "No passengers - boat cannot move"
def test_speeds(n_passengers, expected_mph): assert mph(n_passengers) == expected_mph
from ncrboats import mph assert mph(4) < mph(2), "4 passengers should row slower than 2" assert mph(2) > mph(1), "2 passengers should row faster than 1" # assert mph(0) == 0, "No passengers - boat cannot move" # assert mph(2) == 3 - (2 / 3) assert mph(2) == 2.3333333333333333