示例#1
0
 def test_delete_at_head__non_empty_list_with_one_element__ok(self):
     alist = LinkedList(Node(1))
     assert str(alist) == "1 -> None"
     assert alist.get_head().data == 1
     alist.delete_at_head()
     assert alist.is_empty() is True
     assert alist.get_head() is None
示例#2
0
 def test_delete_at_head__empty_list__ok(self):
     alist = LinkedList()
     assert alist.is_empty() is True
     assert alist.get_head() is None
     alist.delete_at_head()
     assert alist.is_empty() is True
     assert alist.get_head() is None
示例#3
0
 def test_delete_at_head__empty_list_with_many_elements__ok(self):
     alist = LinkedList()
     for i in range(1, 4):
         alist.insert_at_head(i)
     assert str(alist) == "3 -> 2 -> 1 -> None"
     assert alist.get_head().data == 3
     alist.delete_at_head()
     assert str(alist) == "2 -> 1 -> None"
     assert alist.get_head().data == 2