assert statements in tests

0 views
Skip to first unread message

Robert Schuppenies

unread,
Jul 15, 2009, 4:58:40 PM7/15/09
to pympler-dev
I was just going through the tests and found that the assert statement
is used quite often in favor of the assert* statements. E.g.,

"assert asizeof.asizeof(Foo, code=True) > 0" vs
"self.assertTrue(asizeof.asizeof(Foo, code=True) > 0)

Although less verbose, I Python devs mostly seem to agree to use the
latter version rather than the former. The main reason:

1. they are optimized away in "-Oxxx" mode
2. they don't provide good reporting in case of failure

Also, the BDFL recommends them (just to put some weight behind the
argument :P). A long discussion can be found here: http://bugs.python.org/issue2578

I propose to also use the latter statement and would take over the
task of converting the current usage.


cheers,
robert
Reply all
Reply to author
Forward
0 new messages