def test_bst(): bst = BinarySearchTree() one = Node(15) two = Node(12) three = Node(25) four = Node(24) five = Node(29) six = Node(36) bst.root = one one.left = two one.right = three three.left = four three.right = five five.right = six return bst
def test_bst_contains_false(): hal = BinarySearchTree() jarvis = Node(9) mr_robot = Node(3) dva = Node(4) navi = Node(5) gdi = Node(7) nod = Node(2) ghost = Node(6) winter = Node(1) navi.left = nod navi.right = gdi nod.left = winter nod.right = dva dva.left = mr_robot gdi.left = ghost gdi.right = jarvis hal.root = navi actual = hal.contains(8) assert actual == False
def test_bst_instance(): hal = BinarySearchTree() assert hal.root == None hal.root = Node(9) assert hal.root.value == 9