Michael Foord mich...@voidspace.org.uk added the comment:
Cool.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6275
___
___
Python-bugs-list
Kristján Valur Jónsson krist...@ccpgames.com added the comment:
Committed this much more harmless patch to the trunk as revision 74556
--
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6275
Changes by Raghuram Devarakonda draghu...@gmail.com:
--
nosy: +draghuram
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6275
___
___
Jean-Paul Calderone exar...@divmod.com added the comment:
I just want to second Kristján's position. I've used assertRaises a lot
over the years (an implementation in a third-party unit testing library)
and it is extremely common that I want the exception object to perform
the kind of checks he
Kristján Valur Jónsson krist...@ccpgames.com added the comment:
Guido's comment is out of date. The assertRaises(exception) already
returns something: A context manager.
If we don't want to return the object, how about retainig it in the
context manager, then?
It is very awkward otherwise
Michael Foord mich...@voidspace.org.uk added the comment:
Well, his comment was made after assertRaises had already been made a
context manager.
Keeping the exception attached to the context manager is an interesting
suggestion and a less 'surprising' change to the API.
--
Michael Foord mich...@voidspace.org.uk added the comment:
I disagree that the regex version is half-assed though. If all you want
to do is to make assertions about the exception message (the most common
use case in *my* experience) it is enormously convenient.
--
Kristján Valur Jónsson krist...@ccpgames.com added the comment:
Uploading a slimmed down patch, with only the exc_value memeber added to
the assertRaises context manager.
--
Added file: http://bugs.python.org/file14298/unitest2.patch
___
Python
Kristján Valur Jónsson krist...@ccpgames.com added the comment:
Ok, maybe a bad choice of words :)
I don't write unittests that much, of course, but I have found that when I
am writing tests for stuff such as http, I want to verify the actual error
code, i.e. HTTPError.code, which is not
Michael Foord mich...@voidspace.org.uk added the comment:
This was suggested before on Python-dev and Guido rejected it as it is
an 'odd' API for a unittest assert method - none of the others return
anything.
--
resolution: - rejected
status: open - closed
New submission from Kristján Valur Jónsson krist...@ccpgames.com:
It can be useful, after a unittest.assertRaises() or assertRaisesRegexp()
to be able to take a closer look at the exception that was raised.
To this end, I propose returning the caught exception from these methods.
Additionally,
Changes by Georg Brandl ge...@python.org:
--
assignee: - michael.foord
nosy: +michael.foord
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6275
___
12 matches
Mail list logo