def test_DeleteNodeByKeyOneNode(self): testKey = 0 tree = BST(BSTNode(testKey, testKey, None)) self.assertTrue(tree.FindNodeByKey(testKey).NodeHasKey) self.assertTrue(tree.DeleteNodeByKey(testKey)) self.assertFalse(tree.FindNodeByKey(testKey).NodeHasKey) self.assertTrue(tree.Root is None)
def test_DeleteNodeByKeyEmpty(self): tree = BST(None) self.assertFalse(tree.DeleteNodeByKey(0))