def test_shift_with_one_updates_head(): test_dll = Dll() test_dll.insert(3) test_dll.shift() with pytest.raises(ValueError): test_dll.pop()
def test_dll(): test_dll = Dll() test_dll.insert('test1') test_dll.insert('test2') test_dll.append('test3') return test_dll
def test_pop_empty(): test_dll = Dll() with pytest.raises(ValueError): test_dll.pop()
def test_constructor(): test_dll = Dll() assert test_dll.head is None assert test_dll.tail is None
def test_string(): test_list = Dll() test_list.insert(u'éclaire') assert str(test_list) == "('\xc3\xa9claire')"
def test_unicode(): test_list = Dll() test_list.insert(u'ö') assert unicode(test_list) == u"('ö')"
def test__str__returns_single_output_if_only_one_item(): test_list = Dll() test_list.insert('test') assert str(test_list) == "('test')"
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