Re: [Pyunit-interest] How to test a condition
Brought to you by:
purcell
From: Steve P. <ste...@ya...> - 2001-09-03 05:53:48
|
Chuck Esterbrook wrote: > The Py 2.1 docs direct the user to use self.failUnless() while the online > docs at pyunit.sourceforge.net make it clear that using the assert > statement is simple, easy and normal. > > Since the latest pyunit was released post-Py 2.1, does this imply that Py > 2.2 will also lean towards the assert statement? > > I'm curious: Are the docs for unittest at Python and at pyunit maintained > separately? Yes they are. I'm guilty of writing the separate pyunit docs, and Fred Drake wrote the standard library docs for the unittest module. There was some discussion about the appropriateness of using 'assert' and AssertionError when the Py2.1 integration was made. PyUnit was modified so that a different error could be used to indicate failure at a later date if Python's 'assert' and optimisation behaviour is altered. So the best idea is probably to favour the TestCase methods such as 'failUnless()' over the 'assert' statement. However, I still use the 'assert' statement when I feel like it, and when I don't plan to run tests with Python's -O optimisation enabled. How's that for muddying the waters? :-) -Steve -- Steve Purcell, Pythangelist Get testing at http://pyunit.sourceforge.net/ GPG fingerprint: EB79 2AB1 D494 16F9 8C3B DAC6 5341 30CE BCCA EBEA |