Пример #1
0
def test_shift_with_one_updates_head():
    test_dll = Dll()
    test_dll.insert(3)
    test_dll.shift()

    with pytest.raises(ValueError):
        test_dll.pop()
Пример #2
0
def test_dll():
    test_dll = Dll()
    test_dll.insert('test1')
    test_dll.insert('test2')
    test_dll.append('test3')

    return test_dll
Пример #3
0
def test_pop_empty():
    test_dll = Dll()

    with pytest.raises(ValueError):
        test_dll.pop()
Пример #4
0
def test_constructor():
    test_dll = Dll()

    assert test_dll.head is None
    assert test_dll.tail is None
Пример #5
0
def test_string():
    test_list = Dll()
    test_list.insert(u'éclaire')
    assert str(test_list) == "('\xc3\xa9claire')"
Пример #6
0
def test_unicode():
    test_list = Dll()
    test_list.insert(u'ö')
    assert unicode(test_list) == u"('ö')"
Пример #7
0
def test__str__returns_single_output_if_only_one_item():
    test_list = Dll()
    test_list.insert('test')

    assert str(test_list) == "('test')"
Пример #8
0
def test_remove_last_item():
    test_list = Dll()
    test_list.insert(5)
    test_list.remove(5)
    assert test_list.head is None and test_list.tail is None