[issue2578] Figure out what to do with unittest's redundant APIs

Gregory P. Smith report at bugs.python.org
Sun Mar 29 03:46:52 CEST 2009


Gregory P. Smith <greg at krypto.org> added the comment:

Some statistics from our large code base as to which of the assert
methods get used relative to the others:

These percentages are relative to the count of assertEqual(s) uses being
100% and cover python code written by a crazy large number of engineers.

assertListEqual	        4.61%
assertNotEqual(s)	1.91%
assertDictEqual	        1.90%
assertIn	        1.75%
assertSameElements	1.08%
assertIsNone	        0.47%
assertGreater	        0.37%
assertMultiLineEqual	0.36%
assertNotIn	        0.36%
assertLess	        0.24%
assertRaisesWithRegexpMatch 0.23%
assertIsNotNone	        0.20%
assertSetEqual	        0.16%
assertGreaterEqual	0.11%
assertLessEqual	        0.09%
assertTupleEqual	0.04%
assertSequenceEqual	0.04%
assertDictContainsSubset 0.02%

assertSequenceEqual is used by the List and Tuple equal functions so its
stand alone use isn't that relevant.  DictContainsSubset does not appear
to be used much.


I -did- add casing for the type to the main assertEqual method so it may
make sense to make the new type specific methods private so that they're
not part of the public API (ie: I agree with pitrou that it seems
pointless).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2578>
_______________________________________


More information about the Python-bugs-list mailing list