Beispiel #1
0
def test_fraction():
    """
    Test that it can sum a tuple of integers
    """
    data = [Fraction(1, 4), Fraction(1, 4), Fraction(2, 4)]
    print(my_sum_func(data))
    assert my_sum_func(data) == 1
Beispiel #2
0
def test_list_int():
    """
    Test that it can sum a list of integers
    """
    data = [1, 2, 3]
    assert my_sum_func(data) == 6
Beispiel #3
0
def test_bad_type():
    data = 'banana'
    with pytest.raises(TypeError):
        my_sum_func(data)
Beispiel #4
0
def test_sum_of_complex():
    """
    Test that it can sum a tuple of integers
    """
    data = [-2 + 1j, 1 + 2j]
    assert my_sum_func(data) == -1 + 3j
Beispiel #5
0
def test_zero_sum():
    """
    Test that it can sum a tuple of integers
    """
    data = [-2, 1, 1]
    assert my_sum_func(data) == 0
Beispiel #6
0
def test_tuple_int():
    """
    Test that it can sum a tuple of integers
    """
    data = (1, 2, 3)
    assert my_sum_func(data) == 6