Message160762
| 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: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 |
|