本文整理汇总了Python中bst.BinarySearchTree._get方法的典型用法代码示例。如果您正苦于以下问题:Python BinarySearchTree._get方法的具体用法?Python BinarySearchTree._get怎么用?Python BinarySearchTree._get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bst.BinarySearchTree
的用法示例。
在下文中一共展示了BinarySearchTree._get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_leaf
# 需要导入模块: from bst import BinarySearchTree [as 别名]
# 或者: from bst.BinarySearchTree import _get [as 别名]
def test_multiple_leaf(self):
""" Tree of single item. """
a = BinarySearchTree()
a[7] = 'Harry'
a[8] = 'Ron'
a.put(4, 'Hermione')
a[9] = 'Ginny'
self.assertFalse(a._get(7, a.root).isLeaf())
示例2: test_simple_parent
# 需要导入模块: from bst import BinarySearchTree [as 别名]
# 或者: from bst.BinarySearchTree import _get [as 别名]
def test_simple_parent(self):
""" Check parent. """
a = BinarySearchTree(7, 'Harry')
a[8] = 'Ron'
self.assertTrue(a._get(8, a.root).parent.value == 'Harry')
示例3: test_is_root
# 需要导入模块: from bst import BinarySearchTree [as 别名]
# 或者: from bst.BinarySearchTree import _get [as 别名]
def test_is_root(self):
""" Check if root node is identified correctly. """
a = BinarySearchTree(7, 'Harry')
a[8] = 'Ron'
self.assertTrue(a.root.isRoot())
self.assertFalse(a._get(8, a.root).isRoot())