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 2010年12月26日 19:18 by r.david.murray, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| patch.diff | Winston.Ewert, 2011年02月16日 01:14 | patch | review | |
| issue10775-2.diff | ezio.melotti, 2011年04月30日 10:54 | review | ||
| Messages (15) | |||
|---|---|---|---|
| msg124675 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年12月26日 19:18 | |
assertRaises used as a method can't take a msg keyword argument because all args and keywords are passed to the callable. But in context manager form it could, and this can be useful. See, for example, issue 3583. |
|||
| msg125169 - (view) | Author: Michael Foord (michael.foord) * (Python committer) | Date: 2011年01月03日 13:48 | |
I'm fine with this functionality being added in 3.3. |
|||
| msg128623 - (view) | Author: Winston Ewert (Winston.Ewert) | Date: 2011年02月16日 01:14 | |
I decided to try my hand at writing a patch for python. I ended up implementing the behavior for assertRaises, assertRaisesRegex, assertWarns, and assertWarnsRegex. I also made those functions complain about other arguments rather then just ignoring them. |
|||
| msg130840 - (view) | Author: Robbie Clemons (robquad) | Date: 2011年03月14日 16:02 | |
Changing callableObj to callable_obj in assertRaises will break for anyone that's upgrading to 3.3. I left a comment on the review. |
|||
| msg130897 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2011年03月14日 20:58 | |
Aren't such use cases already covered by assertRaisesRegex? |
|||
| msg130907 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2011年03月14日 21:31 | |
How does assertRaisesRegex address the use case in issue 3583? |
|||
| msg130943 - (view) | Author: Winston Ewert (Winston.Ewert) | Date: 2011年03月15日 01:56 | |
robquad mentions having left a comment on the review, but I'm not seeing how to view it. Can somebody explain? It wasn't necessary to change the callable_obj bit, but both form were being used so I thought it best to standardize. Neither version of the parameter name shows up in the documentation. |
|||
| msg130966 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2011年03月15日 12:20 | |
Michael pointed out that I had completely missed the point of what the "msg" argument was about. Sorry for the noise. |
|||
| msg130968 - (view) | Author: SilentGhost (SilentGhost) * (Python triager) | Date: 2011年03月15日 13:04 | |
> I left a comment on the review. You need to publish your comment if you want others to see it. |
|||
| msg130970 - (view) | Author: Brian Curtin (brian.curtin) * (Python committer) | Date: 2011年03月15日 13:17 | |
I showed robquad how to do the review stuff at PyCon but I forgot about the publish part. Robbie, if you hit "Publish + Mail Comments" near the top of the page after you've left comments, it'll send them out. What he noticed was that changing to callable_obj in the assertRaises signature could break anyone who had been using callableObj as a named argument. Although it isn't explicitly documented, it's a named argument that someone is probably using. As for standardizing, it's probably best to match the general format of the library which is camelCase, and change the internal uses rather than a public method signature. |
|||
| msg130988 - (view) | Author: Winston Ewert (Winston.Ewert) | Date: 2011年03月15日 16:15 | |
The public methods were using both callable_obj and callableObj. Perhaps the patch should standardize on callableObj and accept callable_obj with a warning? |
|||
| msg134849 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年04月30日 10:54 | |
Attached a revised patch. While I agree that an error should be raised when extra args are provided in the context manager form, this is out of the scope of the issue, so I didn't include those changes. |
|||
| msg135276 - (view) | Author: Michael Foord (michael.foord) * (Python committer) | Date: 2011年05月06日 11:03 | |
New patch by Ezio looks good to me. Go ahead and commit. Please raise a separate issue for error reporting when invalid argument combinations are used. (i.e. additional keyword arguments but no callable.) |
|||
| msg135278 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年05月06日 12:02 | |
New changeset 8fc801ca9ea1 by Ezio Melotti in branch 'default': Issue #10775: assertRaises, assertRaisesRegex, assertWarns, and assertWarnsRegex now accept a keyword argument 'msg' when used as context managers. Initial patch by Winston Ewert. http://hg.python.org/cpython/rev/8fc801ca9ea1 |
|||
| msg135279 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年05月06日 12:07 | |
Done, thanks for the patch! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:10 | admin | set | github: 54984 |
| 2011年05月06日 12:07:25 | ezio.melotti | set | status: open -> closed resolution: accepted messages: + msg135279 stage: patch review -> resolved |
| 2011年05月06日 12:02:49 | python-dev | set | nosy:
+ python-dev messages: + msg135278 |
| 2011年05月06日 11:03:01 | michael.foord | set | messages: + msg135276 |
| 2011年05月05日 12:19:59 | ncoghlan | set | nosy:
- ncoghlan |
| 2011年04月30日 10:55:41 | ezio.melotti | set | files: - issue10775-2.diff |
| 2011年04月30日 10:55:28 | ezio.melotti | set | files: + issue10775-2.diff |
| 2011年04月30日 10:54:04 | ezio.melotti | set | files:
+ issue10775-2.diff messages: + msg134849 stage: needs patch -> patch review |
| 2011年04月30日 09:00:14 | ezio.melotti | set | assignee: michael.foord -> ezio.melotti |
| 2011年03月15日 16:58:46 | michael.foord | set | assignee: michael.foord nosy: rhettinger, ncoghlan, ezio.melotti, r.david.murray, michael.foord, brian.curtin, SilentGhost, daniel.urban, Winston.Ewert, robquad |
| 2011年03月15日 16:15:46 | Winston.Ewert | set | nosy:
rhettinger, ncoghlan, ezio.melotti, r.david.murray, michael.foord, brian.curtin, SilentGhost, daniel.urban, Winston.Ewert, robquad messages: + msg130988 |
| 2011年03月15日 13:17:15 | brian.curtin | set | nosy:
+ brian.curtin messages: + msg130970 |
| 2011年03月15日 13:04:23 | SilentGhost | set | nosy:
+ SilentGhost messages: + msg130968 |
| 2011年03月15日 12:20:55 | ncoghlan | set | nosy:
rhettinger, ncoghlan, ezio.melotti, r.david.murray, michael.foord, daniel.urban, Winston.Ewert, robquad messages: + msg130966 |
| 2011年03月15日 01:56:49 | Winston.Ewert | set | nosy:
rhettinger, ncoghlan, ezio.melotti, r.david.murray, michael.foord, daniel.urban, Winston.Ewert, robquad messages: + msg130943 |
| 2011年03月14日 21:31:08 | r.david.murray | set | nosy:
rhettinger, ncoghlan, ezio.melotti, r.david.murray, michael.foord, daniel.urban, Winston.Ewert, robquad messages: + msg130907 |
| 2011年03月14日 20:58:20 | ncoghlan | set | nosy:
+ ncoghlan messages: + msg130897 |
| 2011年03月14日 16:02:52 | robquad | set | nosy:
+ robquad messages: + msg130840 |
| 2011年02月16日 01:14:40 | Winston.Ewert | set | files:
+ patch.diff nosy: + Winston.Ewert messages: + msg128623 keywords: + patch |
| 2011年01月21日 08:33:43 | daniel.urban | set | nosy:
+ daniel.urban |
| 2011年01月21日 05:22:16 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2011年01月03日 13:48:46 | michael.foord | set | messages: + msg125169 |
| 2010年12月26日 19:30:18 | r.david.murray | link | issue3583 dependencies |
| 2010年12月26日 19:18:47 | r.david.murray | create | |