Beispiel #1
0
def test_simple():
    num_list = [1, 2]
    observed = mean(num_list)
    expected = 1.5
    assert observed == expected, 'My test failed'
Beispiel #2
0
def test_many(num_list, expected_mean):
    assert mean(num_list) == expected_mean
Beispiel #3
0
def test_empty():
    with pytest.raises(ZeroDivisionError):
        mean([])
Beispiel #4
0
def test_type_error():
    with pytest.raises(TypeError):
        mean(['a', 'b', 'c', 'd'])
Beispiel #5
0
def test_more(num_list):
    assert mean(num_list) == 3.0