예제 #1
0
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")
예제 #2
0
def test_takes_two_to_row():
    assert mph(2) > mph(1), "2 passengers should row faster than 1"
예제 #3
0
def test_passengers_slow_us_down():
    assert mph(4) < mph(2), "4 passengers should row slower than 2"
예제 #4
0
def test_exact_speed():
    assert mph(2) == 3 - (2 / 3)
예제 #5
0
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
예제 #7
0
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