[issue10273] Clean-up Unittest API
Raymond Hettinger <report <at> bugs.python.org>
2010-11-01 00:13:42 GMT
New submission from Raymond Hettinger <rhettinger <at> users.sourceforge.net>:
* Dedocument assertSetEqual, assertDictEqual, assertListEqual, and assertTupleEqual. These are all
automatically dispatched from assertEqual. The user need not call any of these directly. These methods
should not have been exposed in the docs.
* Add new names and dedocument old names for assertLess, assertLessEqual, assertGreater,
assertGreaterEqual. The new names are modeled after the gt, le, lt convention used elsewhere in the
language. This avoids to problems remembering the current spelling quirks (dropping the Than in
LessEqual, pluralization, camel casing, being too long, etc). New names will be assertLE, assertLT,
assertGE, and assertGT.
* Add news names and dedocument assertRegexpMatches and assertNotRegexpMatches. These names haves have
multiple issues (they actually do a re.search not a re.match, they are long, the pluralization is
inconsistent with the assertEqual convention, they don't agree with the names used in other unittest
implementations such as PHPunit and Junit). The new names will be assertRegexp and assertNotRegexp.
* Remove the assertItemsEqual method (which is new in 3.2). Its semantics are not obvious from its name
(i.e. duplicates matter, order does not matter, expects elements not items, has O(n**2) behavior after
an impending bug fix, uses on equality for matching not hashing or ordering). In most common cases, it is
more explicit and flexible to use assertEqual after casting to a set, a list, or sorted list. Also note that
other unittest implementations such as PHPunit and JUnit do not have this method. See
* Recombine the package into a single file. See
http://mail.python.org/pipermail/python-dev/2010-October/105025.html and http://mail.python.org/pipermail/python-dev/2010-October/104887.html
* We need to review the camel cased spelling on two methods that are new in 3.2. Should it be assertIsinstance