[Python-ideas] unittest.failureExeption(msg, data=None): add optional data kwarg to failureException() of unittest

Neil Girdhar mistersheik at gmail.com
Wed Mar 4 06:59:32 CET 2015


You got it.

On Wed, Mar 4, 2015 at 12:55 AM, Thomas Güttler <
guettliml at thomas-guettler.de> wrote:

> Am 04.03.2015 um 02:45 schrieb Neil Girdhar:
> > Says it right in the documentation:
> >
> > failureException
> > <
> https://docs.python.org/2/library/unittest.html#unittest.TestCase.failureException
> >
> >
> > This class attribute gives the exception raised by the test method. If a
> > test framework needs to use a specialized exception, possibly to carry
> > additional information, it must subclass this exception in order to “play
> > fair” with the framework. The initial value of this attribute is
> > AssertionError
> > <
> https://docs.python.org/2/library/exceptions.html#exceptions.AssertionError
> >
>
> You are right.
>
> And if you want to assertEqual(a, b) to capture a and b,
> you need to replace assertEqual to forward the values to
> your own failureException.
>
> I guess we will go this way: replace failureException and
> assertEqual(), assertIn(), ....
>
> No change in Python's unittest lib is needed.
>
> Thank you for your reply.
>
>   Thomas Güttler
>
> --
> http://www.thomas-guettler.de/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150304/d9e8ae51/attachment.html>


More information about the Python-ideas mailing list