Beispiel #1
0
    def test_key_iterator(self):
        a = AVLTree()
        values = [
            (1, 'a'),
            (2, 'b'),
            (3, 'c'),
        ]
        for k, v in values:
            a[k] = v

        self.assert_list(a.keys(), [k for k, _ in values])
Beispiel #2
0
 def test_traversal_on_balanced(self):
     a = AVLTree()
     a[2] = "a"
     a[1] = "b"
     a[3] = "c"
     self.assertListEqual([1, 2, 3], list(a.keys()))