This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author patricksmith
Recipients patricksmith
Date 2012-05-15.21:13:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1337116395.1.0.710278359687.issue14819@psf.upfronthosting.co.za>
In-reply-to
Content
The attached patch adds two helper methods to `unittest.TestCase`: `assertIsSubclass` and `assertIsNotSubclass`. These methods are similar to the `assertIsInstance` and `assertIsNotInstance` methods that are already part of `unittest.TestCase`. They allow one to test if a class is a subclass of another class using the `issubclass` builtin.

These methods can be used like:
    self.assertIsSubclass(cls, parent_cls)

These new methods provide a nicer error message and more consistent interface over the alternatives:
    self.assertTrue(issubclass(cls, parent_cls))
    assert issubclass(cls, parent_cls)
History
Date User Action Args
2012-05-15 21:13:15patricksmithsetrecipients: + patricksmith
2012-05-15 21:13:15patricksmithsetmessageid: <1337116395.1.0.710278359687.issue14819@psf.upfronthosting.co.za>
2012-05-15 21:13:14patricksmithlinkissue14819 messages
2012-05-15 21:13:14patricksmithcreate