Пример #1
0
def test_empty_array():
    assert summary_ranges([]) == []
Пример #2
0
def test_negative_numbers():
    task = [-2, 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 12]
    answer = ['-2', '0->7', '9->10', '12']
    assert summary_ranges(task) == answer
Пример #3
0
def test_multiple_ranges():
    assert summary_ranges([0, 1, 2, 5, 6, 9]) == ['0->2', '5->6', '9']
Пример #4
0
def test_one_big_range():
    assert summary_ranges([0, 1, 2, 3, 4, 5, 6, 7]) == ['0->7']
Пример #5
0
def test_one_range():
    assert summary_ranges([1, 2, 3, 4]) == ['1->4']
Пример #6
0
def test_all_items_equal():
    assert summary_ranges([1, 1, 1, 1]) == ['1']