[TIP] Asserting behaviour of exception tracebacks

Ben Finney bignose+hates-spam at benfinney.id.au
Thu Jan 31 22:46:01 PST 2008

"Jonathan Lange" <jml at mumak.net> writes:

> 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.

That's an interesting approach. I like it because getting at the
exception object is clearly useful; but it does change the convention
that TestCase assertions either return None or raise an exception.

 \      "Smoking cures weight problems. Eventually."  -- Steven Wright |
  `\                                                                   |
_o__)                                                                  |
Ben Finney

More information about the testing-in-python mailing list