msg113505 - (view) |
Author: Denver Coneybeare (denversc) * |
Date: 2010-08-10 02:53 |
Some of the unit testing code in test_argparse.py could be modified to take advantage of the new unittest features in Python 2.7 and 3.x. My suggested changes are attached in the patch file test_argparse.py.unittest2.patch One big one is that assertEquals() now prints a "diff" when multi-line strings compare unequal, so the manual "diffing" logic from the unit tests can be removed. Also, assertIsNone() is slightly better than assertEquals(None, x). Finally, there is a tiny fix where parse_args() was expected to throw ArgumentParserError but the test would not fail if it threw no exceptions. |
|
|
msg113513 - (view) |
Author: Steven Bethard (bethard) *  |
Date: 2010-08-10 09:37 |
These all look like good changes to me. (I looked at the patch, but haven't tried applying it though.) |
|
|
msg125314 - (view) |
Author: Sandro Tosi (sandro.tosi) *  |
Date: 2011-01-04 13:24 |
Hi, I've applied the patch and it goes fine (except for some offsets and the fact it was generated inside Lib/test) and the tests are still all ok. I'd suggest to apply it. |
|
|
msg161233 - (view) |
Author: Radu Voicilas (raduv) |
Date: 2012-05-20 21:40 |
The patch is still valid - it applies ok. The only issues as mentioned by sandro.tosi are offsets and that it was generated inside Lib/ It would be worth having these changes applied. |
|
|
msg161247 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-05-21 06:21 |
Another one: except ArgumentParserError: err = sys.exc_info()[1] This reeks of single-codebase-for-2.x-and-3.x and could probably be replaced by assertRaises or at least a regular except...as. |
|
|
msg161249 - (view) |
Author: Radu Voicilas (raduv) |
Date: 2012-05-21 07:39 |
Hi Eric, Denver's patch should apply correctly from the root. Also, I've made the changes you mention: try: except: assert has been replaced by: with self.assertRaises() |
|
|
msg179048 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-01-04 17:23 |
See also . |
|
|
msg221910 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2014-06-29 22:32 |
Latest patch LGTM so can we have a commit review please. |
|
|
msg222002 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2014-07-01 02:34 |
Updated patch to use assertRaisesRegex in test_invalid_action, test_multiple_dest |
|
|
msg222277 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2014-07-04 11:05 |
Updated patch. |
|
|
msg222396 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2014-07-06 06:33 |
New changeset f240ca6345c8 by Berker Peksag in branch 'default': Issue #9554: Use modern unittest features in test_argparse. http://hg.python.org/cpython/rev/f240ca6345c8 |
|
|
msg222397 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2014-07-06 06:34 |
Thanks Denver and Radu. And thanks for the review, Ezio. |
|
|