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