Message160762
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) |
|
Date |
User |
Action |
Args |
2012-05-15 21:13:15 | patricksmith | set | recipients:
+ patricksmith |
2012-05-15 21:13:15 | patricksmith | set | messageid: <1337116395.1.0.710278359687.issue14819@psf.upfronthosting.co.za> |
2012-05-15 21:13:14 | patricksmith | link | issue14819 messages |
2012-05-15 21:13:14 | patricksmith | create | |
|