def test_mysum(numbers, output):
    assert mysum(numbers) == output
    for num in numbers:
        assert type(num) == int
    assert (len(numbers) % 2) == 1
def test_sum_floats():
    assert mysum([0.1, 1.2, 2.3, 3.4, 4.5]) == 11.5
def test_sum_integers():
    assert mysum([0, 1, 2, 3, 4]) == 10
def test_mysum(numbers, output):
    assert mysum(numbers) == output
def test_sum_nothing():
    assert mysum([]) == 0
示例#6
0
def test_mysum(numbers, output):
    assert mysum(numbers) == output
    assert (len(numbers) % 2) == 1