Re: [Python-Dev] Proposed unittest changes On Fri, Apr 18, 2008 at 8:34 AM, Guido van Rossum  wrote:
>
> On Thu, Apr 17, 2008 at 3:31 PM, Jonathan Lange  wrote:
>  > On Thu, Apr 17, 2008 at 11:49 PM, Michael Foord
>  >   wrote:
>  >  >     assert_raises_with_message    (exc_class, message, callable, *args,
>  >  >  **keywargs)
>  >  >
>  >
>  >  I don't think this one should go in.
>  >
>  >  I think it would be better if assertRaises just returned the exception
>  >  object that it catches. That way, you can test properties of the
>  >  exception other than its message.
>
>  Hm. I've got to say that returning the exception object is, um, an odd
>  API in the set of unittest APIs. I can see how it's sometimes more
>  powerful, but I'd say that in many cases assertRaisesWithMessage will
>  be easier to write and read. (And making it a regex match would be
>  even cooler.)

I don't know about odd. It works and it's not obviously terrible.

Not having it the unittest API simply means that people who do want to
test non-message properties will rewrite assertRaises. Which is, in
fact, what we've already done.

jml
_______________________________________________
Python-Dev mailing list
zvllln-eum@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40tangomu.com


