def test_iterator_empty_tree(self):
     tree = CartesianTree()
     self.assertEqual(list(tree), [])
 def test_reversed_empty_tree(self):
     tree = CartesianTree()
     self.assertEqual(list(reversed(tree)), [])
 def complicated_tree() -> CartesianTree:
     tree = CartesianTree()
     tree.insert_with_priority(1, "val1", 5)
     tree.insert_with_priority(2, "val2", 4)
     tree.insert_with_priority(3, "3", 1)
     tree.insert_with_priority(4, "123", 11)
     tree.insert_with_priority(5, "text", 1)
     tree.insert_with_priority(6, 6, 6)
     tree.insert_with_priority(7, 0.1, 3)
     return tree
 def test_len_empty_tree(self):
     tree = CartesianTree()
     self.assertEqual(len(tree), 0)
 def test_get_empty_tree(self):
     tree = CartesianTree()
     with self.assertRaises(KeyError):
         value = tree[0]
 def test_delete_empty_tree(self):
     tree = CartesianTree()
     with self.assertRaises(KeyError):
         del tree[0]
 def test_add_check_key(self):
     tree = CartesianTree()
     tree[1] = 2
     self.assertTrue(1 in tree)