Пример #1
0
def test_add_one_number():
    assert Add("3") == 3
Пример #2
0
def test_other_delimiters():
    assert Add("//%\n1%2%3") == 6
    assert Add("//X\n1X2") == 3
Пример #3
0
def test_add_nothing():
    assert Add("") == 0
Пример #4
0
def test_negatives_exception():
    with pytest.raises(Exception) as error:
        Add("-2,4,-5,-7")
    assert "Negatives not allowed: -2,-5,-7" in str(error.value)
Пример #5
0
def test_ignore_above_1000():
    assert Add("1001,4") == 4
Пример #6
0
def test_add_with_newline_delimiter():
    assert Add("1\n2\n3") == 6
Пример #7
0
def test_add_unknown_amt_of_numbers():
    assert Add("3,7,14,11,2") == 37
Пример #8
0
def test_add_two_numbers():
    assert Add("3,7") == 10