本文整理汇总了Python中LinkedList.get_last方法的典型用法代码示例。如果您正苦于以下问题:Python LinkedList.get_last方法的具体用法?Python LinkedList.get_last怎么用?Python LinkedList.get_last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedList
的用法示例。
在下文中一共展示了LinkedList.get_last方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_when_adding_second_element_previous_one_should_point_to_it
# 需要导入模块: import LinkedList [as 别名]
# 或者: from LinkedList import get_last [as 别名]
def test_when_adding_second_element_previous_one_should_point_to_it(self):
linked_list = LinkedList()
linked_list.add('test item 0')
first_node = linked_list.get(0)
linked_list.add('test item 1')
self.assertEqual(first_node.next_node, linked_list.get_last())
示例2: LinkedList
# 需要导入模块: import LinkedList [as 别名]
# 或者: from LinkedList import get_last [as 别名]
def test_when_3_items_have_been_added_and_last_one_removed_then__get_last__should_return_second_item_with_no_next_node(self):
linked_list = LinkedList()
linked_list.add('test item 0')
linked_list.add('test item 1')
linked_list.add('test item 2')
linked_list.remove(2)
last_node = linked_list.get_last()
self.assertEqual(last_node.value, 'test item 1')
self.assertIsNone(last_node.next_node)
示例3: test_when_adding_several_items_should_be_able_to_get_last_one
# 需要导入模块: import LinkedList [as 别名]
# 或者: from LinkedList import get_last [as 别名]
def test_when_adding_several_items_should_be_able_to_get_last_one(self):
linked_list = LinkedList()
linked_list.add('test item 0')
linked_list.add('test item 1')
last_node = linked_list.get_last()
self.assertEqual(last_node.value, 'test item 1')
示例4: test_when_1_item_have_been_added_and_removed_then_last_item_should_not_be_present
# 需要导入模块: import LinkedList [as 别名]
# 或者: from LinkedList import get_last [as 别名]
def test_when_1_item_have_been_added_and_removed_then_last_item_should_not_be_present(self):
linked_list = LinkedList()
linked_list.add('test item 0')
linked_list.remove(0)
self.assertIsNone(linked_list.get_last())
示例5: test_when_one_item_has_been_added_it_should_be_returned_as_last_one
# 需要导入模块: import LinkedList [as 别名]
# 或者: from LinkedList import get_last [as 别名]
def test_when_one_item_has_been_added_it_should_be_returned_as_last_one(self):
linked_list = LinkedList()
linked_list.add('test item 0')
self.assertEqual(linked_list.get_last().value, 'test item 0')