[Python-Dev] PEP: Consolidating names and classes in the `unittest`module (updated 2008-07-15)

Stephen J. Turnbull stephen at xemacs.org
Tue Jul 15 10:56:57 CEST 2008


Raymond Hettinger writes:

 > Nobody I know spells setup and teardown as two words.

I set up a house of cards.  When I'm done, I'm done with setup.
Similarly for "tear down" and "teardown".  The two word forms are
verbs, the one word forms are nouns.  I don't think it's worth a
column to make that distinction, though.

 > Another thought is that test suite code is going to get seriously crunched when the new, longer method names meet the 78/80 column 
 > pep 8 restrictions.
 > 
 > class TestMisc(unittest.test_case):
 >     def lost_four_spaces_here_already(self):

Eight spaces, actually.  Make that 13 by the time you get to the "."
after "self" in the next line.

 > Are there any ideas for some short, pithy, mnemonic names that are
 > self-explantory and not full of underscores; something that
 > wouldn't suck to type hundreds of times in a good test module?

"test" or "check" instead of "assert" or "fail_unless" comes to mind
to shorten the prefix.  But the best I can come up with for
"fail_unless_equal" is something like "equalize" which really fails
EIBTI.



More information about the Python-Dev mailing list