[TIP] unittest2 assertRaises failure message
Olemis Lang
olemis at gmail.com
Tue Jan 15 14:33:52 PST 2013
On 1/15/13, Michael Rene Armida <me at marmida.com> wrote:
> On Tue, Jan 15, 2013 at 11:41 AM, Olemis Lang <olemis at gmail.com> wrote:
>
>> No that's not the case as I want to detect whether expected exception
>> was not raised or any other kind of failure .
>>
>>
> I don't understand why it's insufficient. Here's your problem, as I
> understand it:
>
> 1) you want to check for the type and existence of an exception
> 2) you want to guarantee that the raised exception has some specific
> information, beyond just its type
>
Yes and no
;)
Yes, because that's tha kind of things I want to do ...
No, because the goal is not to assert that an exception raised by the
SUT has a particular message . The goal is that if assertRaises check
fails (either because another kind of exception was raised or no
exception was raised at all or ...) then I want this test failure to
be reported with a custom message besides «MyException was not raised»
i.e. also including the values of variables in test case's local
namespace .
>
> It's possible that I'm just misunderstanding your problem, and if so, I'm
> sorry.
>
so , I guess so ... but no big deal
;)
Thanks .
--
Regards,
Olemis.
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
Featured article:
More information about the testing-in-python
mailing list