Commit Graph

14 Commits

Author SHA1 Message Date
Michael Foord 345b2fe21e Better exception messages for unittest assert methods.
- unittest.assertNotEqual() now uses the inequality operator (!=) instead
  of the equality operator.

- Default assertTrue and assertFalse messages are now useful.

- TestCase has a longMessage attribute. This defaults to False, but if set to True
  useful error messages are shown in addition to explicit messages passed to assert methods.

Issue #5663
2009-04-02 03:20:38 +00:00
Gregory P. Smith 7558d57ad2 Rename the actual method definitions to the official assertFoo names.
Adds unittests to make sure the old fail* names continue to work now
and adds a comment that they are pending deprecation.

Also adds a test to confirm that the plural Equals method variants
continue to exist even though we're unlikely to deprecate those.

http://bugs.python.org/issue2578
2009-03-31 19:03:28 +00:00
Gregory P. Smith 2839985c7e The unittest.TestCase.assertEqual() now displays the differences in lists,
tuples, dicts and sets on failure.

Many new handy type and comparison specific assert* methods have been added
that fail with error messages actually useful for debugging.  Contributed in
by Google and completed with help from mfoord and GvR at PyCon 2009 sprints.

Discussion lives in http://bugs.python.org/issue2578.
2009-03-31 16:54:10 +00:00
Benjamin Peterson 47d9738b0f rename TestCase.skip() to skipTest() because it causes annoying problems with trial #5571 2009-03-26 20:05:50 +00:00
Benjamin Peterson cb2b0e45d4 comply with the evilJavaNamingScheme for attribute names
It seems my love of PEP 8 overrode the need for consistentcy
2009-03-23 22:29:45 +00:00
Benjamin Peterson 692428e77f implement test skipping and expected failures
patch by myself #1034053
2009-03-23 21:50:21 +00:00
Antoine Pitrou 697ca3d0cb Issue #4444: Allow assertRaises() to be used as a context handler. 2008-12-28 14:09:36 +00:00
Jeffrey Yasskin 2f3c16be73 Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689.
2008-01-03 02:21:52 +00:00
Christian Heimes c756d00cf2 Replaced import of the 'new' module with 'types' module and added a deprecation warning to the 'new' module. 2007-11-27 21:34:01 +00:00
Kristján Valur Jónsson 170eee9d6a Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform. 2007-05-03 20:09:56 +00:00
Tim Peters ea5962f86e Whitespace normalization. 2007-03-12 18:07:52 +00:00
Georg Brandl d9e50261e8 Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
2007-03-07 11:54:49 +00:00
Georg Brandl 15c5ce936f Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
2007-03-07 09:09:40 +00:00
Jim Fulton fafd874bc8 Added an __iter__ method for test suites. 2004-08-28 15:22:12 +00:00