O'Reilly logo

Learning Python Testing by Daniel Arbuckle

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Putting it into practice – an AVL tree

We're going to walk step-by-step through the process of using doctest to create a testable specification for a data structure called an AVL tree. An AVL tree is a way to organize key-value pairs so that they can be quickly located by key. In other words, it's a lot like Python's built-in dictionary type. The name AVL references the initials of the people who invented this data structure.

Note

While AVL trees are similar to Python dictionaries, they have some significantly different properties. For one thing, the keys stored in an AVL tree can be iterated over in a sorted order with no overhead. Another difference is that, while inserting and removing objects in an AVL tree is slower than a Python dict in many ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required