[issue20554] Use specific asserts in optparse test

Berker Peksag report at bugs.python.org
Tue Jul 1 02:08:11 CEST 2014


Berker Peksag added the comment:

diff -r 3b94a4ef244e Lib/test/test_argparse.py
--- a/Lib/test/test_argparse.py	Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_argparse.py	Fri Feb 07 22:34:13 2014 +0200
@@ -4219,7 +4219,7 @@
             e = sys.exc_info()[1]
             expected = 'unknown action'
             msg = 'expected %r, found %r' % (expected, e)
-            self.assertTrue(expected in str(e), msg)
+            self.assertIn(expected, str(e), msg)

The patch in issue 9554 replaces this code with assertRaises and assertRegex (I will change the code to use assertRaisesRegex).

----------
nosy: +berker.peksag
stage:  -> patch review
title: Use specific asserts in argparse and optparse tests -> Use specific asserts in optparse test

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


More information about the Python-bugs-list mailing list