How to optimise this code?

Basilisk96 basilisk96 at gmail.com
Tue Aug 21 22:39:45 EDT 2007


David,

If your true design intent is to run X number of test cases, unittest
is the biggest bang for your buck, like shown by Peter's example. You
just subclass unittest.TestCase, and def your test methods in the
class body; they will simply be executed in the order you list them.
It's just nice how it works that way.

Otherwise, the function factory approach like Hrvoje's
   functionToCall = getattr(self, "testCase%s" % tc)
is the best optimization.

Cheers,
-Basilisk96




More information about the Python-list mailing list