Ejemplo n.º 1
0
 def test_insert_at_tail__empty_list__ok(self):
     alist = LinkedList()
     assert alist.is_empty() is True
     assert alist.get_head() is None
     data = 1
     alist.insert_at_tail(data)
     assert alist.is_empty() is False
     assert alist.get_head().data == data
     assert str(alist) == f"{data} -> None"
Ejemplo n.º 2
0
 def test_insert_at_tail__non_empty_list__ok(self):
     alist = LinkedList(Node("1"))
     assert alist.is_empty() is False
     assert alist.get_head() is not None
     data = 2
     alist.insert_at_tail(data)
     assert alist.is_empty() is False
     assert str(alist) == f"1 -> {data} -> None"
     data = 3
     alist.insert_at_tail(data)
     assert alist.is_empty() is False
     assert str(alist) == f"1 -> 2 -> {data} -> None"