"I have a confession. Even as the author of a public domain
Python library in fairly wide use, I have been far less than
systematic in including unit tests for my modules. In fact, the
bulk of those tests that are included in Gnosis Utilities fall
under gnosis.xml.pickle, and were written by a contributor to that
subpackage. I have found that the large majority of third-party
Python packages I download also lack a thorough unit test
"Moreover, the tests that exist in Gnosis Utilities suffer from
another flaw: you often need to understand the expected output in a
fair amount of detail to even know whether a test succeeds or
fails. What passes as tests are actually -- in many cases -- more
like small utilities that utilize parts of the library. These tests
(or utilities) allow input from arbitrary data sources (of the
right type) and/or output in descriptive data formats. These test
utilities are actually rather useful when you need to debug some
subtle error. But as self-explanatory sanity checks of changes
between library versions, these kinds of tests do not succeed.
"In this installment, I try to improve the tests in my utility
collection using the Python standard library modules doctest and
unittest, and I walk you through my experience (with a few pointers
on best approaches)..."
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.