Пример #1
0
 def test_init(self):
     tree = BinarySearchTree()
     assert tree.root is None
     assert tree.size == 0
     assert tree.is_empty() is True
Пример #2
0
 def test_init_with_list_of_strings(self):
     tree = BinarySearchTree(['B', 'A', 'C'])
     assert tree.root.data == 'B'
     assert tree.size == 3
     assert tree.is_empty() is False
Пример #3
0
 def test_init_with_list_of_tuples(self):
     tree = BinarySearchTree([(2, 'B'), (1, 'A'), (3, 'C')])
     assert tree.root.data == (2, 'B')
     assert tree.size == 3
     assert tree.is_empty() is False
Пример #4
0
 def test_init_with_list(self):
     tree = BinarySearchTree([2, 1, 3])
     assert tree.root.data == 2
     assert tree.size == 3
     assert tree.is_empty() is False