[TIP] Unittest Changes
peke at iki.fi
Mon Jul 21 06:46:02 PDT 2008
it's great to hear that unittest will be enhanced! My favorite
extensions to it would be:
1) Having assertions available as static methods in a separate module.
This would a) make using them with other code easier, and b) make
lines shorter since there would be no need for "self.". With JUnit 4
and Java 5 you can do """import static org.junit.Assert.assertNull"""
and this addition to Python would allow similar """from
unittest.asserts import assertNone""".
2) Having PEP-8-style aliases for asserts. PEP-8 reminds that
consistency within a module is most important, but now my test modules
have inconsistent lines like
Asserts can be also used with non-test code (and above point would
make that even easier), and then adhering PEP-8 is even more
We needed these features so badly in Robot Framework  that we
created a utility module implementing them. Its code is available at
. The code is, of course, trivial but the doc string has some more
More information about the testing-in-python