Adding methods from one class to another, dynamically

Steve Holden steve at
Tue Feb 2 07:06:32 CET 2010

Oltmans wrote:
> On Feb 2, 2:14 am, Steve Holden <st... at> wrote:
>> Should not tee be subclassing test, not unittest.TestCase?
> Thank you, Steve. This worked, but I've not clue why? Can you please
> enlighten me why sub-classing 'test' made it happen? Please. Thanks
> again.

unittest.TestCase doesn't have any test* methods (methods whose names
begin with "test"). So neither do your subclasses.

When you subclass test, however, test has everything that
unittest.TestCase does (because it subclasses unittest.TestCase) and it
also has three test* methods. So your subclass of test also has those
three methods as well.

Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010
Holden Web LLC       

More information about the Python-list mailing list