This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年06月17日 01:34 by jtratner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| unittest.patch | jtratner, 2013年06月17日 01:34 | patch for unittest.rst | review | |
| Messages (3) | |||
|---|---|---|---|
| msg191306 - (view) | Author: Jeff Tratner (jtratner) | Date: 2013年06月17日 01:34 | |
One of the examples for assertRaisesRegex(p) is wrong by one character. Current is: self.assertRaisesRegexp(ValueError, 'invalid literal for.*XYZ$', int, 'XYZ') The $ at the end is wrong because the actual error message is "ValueError: invalid literal for int() with base 10: 'XYZ'" (with a ``'`` at the end). Two options for fixing. Option 1 - remove $ self.assertRaisesRegexp(ValueError, 'invalid literal for.*XYZ', int, 'XYZ') Option 2 - add ' self.assertRaisesRegexp(ValueError, 'invalid literal for.*XYZ\'$', int, 'XYZ') Same example is shown for assertRaisesRegex, so applies to both. And for completeness...here's something you can run to see the error [couldn't figure out how to attach two files]: import unittest class MyTest(unittest.TestCase): def test_example(self): # this fails self.assertRaisesRegexp(ValueError, 'invalid literal for.*XYZ$', int, 'XYZ') def test_option1(self): self.assertRaisesRegexp(ValueError, 'invalid literal for.*XYZ', int, 'XYZ') def test_option2(self): self.assertRaisesRegexp(ValueError, 'invalid literal for.*XYZ\'$', int, 'XYZ') unittest.main() |
|||
| msg192038 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年06月29日 17:16 | |
New changeset 4a714fea95ef by Terry Jan Reedy in branch '2.7': Issue #18237: Fix assertRaisesRegexp error caought by Jeff Tratner. http://hg.python.org/cpython/rev/4a714fea95ef New changeset b3d19f0494e7 by Terry Jan Reedy in branch '3.3': Issue #18237: Fix assertRaisesRegexp error caought by Jeff Tratner. http://hg.python.org/cpython/rev/b3d19f0494e7 |
|||
| msg192039 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2013年06月29日 17:21 | |
I went with adding ' after changing '...' to "...". If you think you might ever submit a more substantial patch, and we hope you do, please submit a Contributor Agreement (now optionally electronic). http://www.python.org/psf/contrib/ When processed (a week?), an * will appear after your name. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:47 | admin | set | github: 62437 |
| 2013年06月29日 17:21:52 | terry.reedy | set | status: open -> closed type: behavior messages: + msg192039 resolution: fixed stage: resolved |
| 2013年06月29日 17:16:43 | python-dev | set | nosy:
+ python-dev messages: + msg192038 |
| 2013年06月21日 21:57:46 | terry.reedy | set | nosy:
+ terry.reedy |
| 2013年06月17日 09:08:10 | berker.peksag | set | versions: - Python 3.1, Python 3.2, Python 3.5 |
| 2013年06月17日 01:34:57 | jtratner | create | |