
Modern Python Cookbook
By :

Good Python includes docstrings inside every module, class, function, and method. One important element of a docstring is an example. While doctest
can make the example into a unit test case, the literal matching of the expected text output against the actual text can cause problems. There are some Python objects that do not have a consistent text representation.
For example, object hash values are randomized. This often results in the order of elements in a set collection being unpredictable. We have several choices for creating test case example output:
PYTHONHASHSEED
environment variable-R
option to disable hash randomization entirelyThere are several other considerations beyond simple variability in the location of keys or items in a set. Here are some other...