[TIP] Asserting behaviour of exception tracebacks

Jonathan Lange jml at mumak.net
Thu Jan 31 15:38:25 PST 2008


On Jan 31, 2008 8:07 PM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> One convenience method we have in our test framework is
> 'assertRaisesWithMessage'. I don't have the code to hand, but it should
> be obvious what it does... :-)
>

Both Trial and the Bazaar unit tests extend 'assertRaises' to return
the exception object raised. This allows you to easily assert things
about the exception, including the message.

jml



More information about the testing-in-python mailing list