Ben Finney wrote: > Andrew Bennetts <[EMAIL PROTECTED]> writes: > > > This one is easily solved by making assertRaises return the > > exception it caught. > > That breaks one simple feature of the unittest API: that all the test > methods will either raise a failure asertion, or return None.
How is returning None a feature? I've never seen code that somehow depends on assertRaises returning None. This “feature” is not documented as being significant in the unittest module documentation anywhere. It is not mentioned anywhere in the *eight* pages of the xUnit Test Patterns book[1] dedicated to Assertion Methods in their general form. Where did you get the notion that it is a feature? Further, I have lots of evidence that in practice returning the exception instance from assertRaises is not a problem, and is in fact quite useful. I'd quote “Practicality beats purity”, but I'm not even sure if it is purity that you have in mind. Demanding that assertion methods return None seems like foolish consistency and dogma. -Andrew. [1] _xUnit Test Patterns: Refactoring Test Code_, by Gerard Meszaros. <http://xunitpatterns.com/>. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com