def test_rightRotationOnRoot(self): tree = AVLTree() tree.insert(3) tree.insert(2) tree.insert(1) tree.root = tree.right_rotation(tree.root) nodes = tree.preorder_traversal() self.assertEqual(nodes, [2, 1, 3])
def test_rightRotationNoRoot(self): tree = AVLTree() tree.right_rotation(tree.root) nodes = tree.preorder_traversal() self.assertEqual(nodes, [])