def test_prepend(self): ll = LinkedList() ll.prepend('C') assert ll.head.data == 'C' assert ll.tail.data == 'C' assert ll.as_list() == ['C'] ll.prepend('B') assert ll.head.data == 'B' assert ll.tail.data == 'C' assert ll.as_list() == ['B', 'C'] ll.prepend('A') assert ll.head.data == 'A' assert ll.tail.data == 'C' assert ll.as_list() == ['A', 'B', 'C']
def test_init_with_list(self): ll = LinkedList(['A', 'B', 'C']) assert ll.head.data == 'A' assert ll.tail.data == 'C' assert ll.as_list() == ['A', 'B', 'C'] assert ll.is_empty() is False
def test_init(self): ll = LinkedList() assert ll.head is None assert ll.tail is None assert ll.as_list() == [] assert ll.is_empty() is True