@@ -883,6 +883,12 @@ Test cases
883883 | :meth: `assertNotIsInstance(a, b) | ``not isinstance(a, b) `` | 3.2 |
884884 | <TestCase.assertNotIsInstance>` | | |
885885 +-----------------------------------------+-----------------------------+---------------+
886+ | :meth: `assertIsSubclass(a, b) | ``issubclass(a, b) `` | 3.14 |
887+ | <TestCase.assertIsSubclass>` | | |
888+ +-----------------------------------------+-----------------------------+---------------+
889+ | :meth: `assertNotIsSubclass(a, b) | ``not issubclass(a, b) `` | 3.14 |
890+ | <TestCase.assertNotIsSubclass>` | | |
891+ +-----------------------------------------+-----------------------------+---------------+
886892
887893 All the assert methods accept a *msg * argument that, if specified, is used
888894 as the error message on failure (see also :data: `longMessage `).
@@ -961,6 +967,15 @@ Test cases
961967 .. versionadded :: 3.2
962968
963969
970+ .. method :: assertIsSubclass(cls, superclass, msg=None)
971+ assertNotIsSubclass(cls, superclass, msg=None)
972+
973+ Test that *cls * is (or is not) a subclass of *superclass * (which can be a
974+ class or a tuple of classes, as supported by :func: `issubclass `).
975+ To check for the exact type, use :func: `assertIs(cls, superclass) <assertIs> `.
976+
977+ .. versionadded :: next
978+
964979
965980 It is also possible to check the production of exceptions, warnings, and
966981 log messages using the following methods:
@@ -1210,6 +1225,24 @@ Test cases
12101225 | <TestCase.assertCountEqual>` | elements in the same number, | |
12111226 | | regardless of their order. | |
12121227 +---------------------------------------+--------------------------------+--------------+
1228+ | :meth: `assertStartsWith(a, b) | ``a.startswith(b) `` | 3.14 |
1229+ | <TestCase.assertStartsWith>` | | |
1230+ +---------------------------------------+--------------------------------+--------------+
1231+ | :meth: `assertNotStartsWith(a, b) | ``not a.startswith(b) `` | 3.14 |
1232+ | <TestCase.assertNotStartsWith>` | | |
1233+ +---------------------------------------+--------------------------------+--------------+
1234+ | :meth: `assertEndsWith(a, b) | ``a.endswith(b) `` | 3.14 |
1235+ | <TestCase.assertEndsWith>` | | |
1236+ +---------------------------------------+--------------------------------+--------------+
1237+ | :meth: `assertNotEndsWith(a, b) | ``not a.endswith(b) `` | 3.14 |
1238+ | <TestCase.assertNotEndsWith>` | | |
1239+ +---------------------------------------+--------------------------------+--------------+
1240+ | :meth: `assertHasAttr(a, b) | ``hastattr(a, b) `` | 3.14 |
1241+ | <TestCase.assertHasAttr>` | | |
1242+ +---------------------------------------+--------------------------------+--------------+
1243+ | :meth: `assertNotHasAttr(a, b) | ``not hastattr(a, b) `` | 3.14 |
1244+ | <TestCase.assertNotHasAttr>` | | |
1245+ +---------------------------------------+--------------------------------+--------------+
12131246
12141247
12151248 .. method :: assertAlmostEqual(first, second, places=7, msg=None, delta=None)
@@ -1279,6 +1312,34 @@ Test cases
12791312 .. versionadded :: 3.2
12801313
12811314
1315+ .. method :: assertStartsWith(s, prefix, msg=None)
1316+ .. method :: assertNotStartsWith(s, prefix, msg=None)
1317+
1318+ Test that the Unicode or byte string *s * starts (or does not start)
1319+ with a *prefix *.
1320+ *prefix * can also be a tuple of strings to try.
1321+
1322+ .. versionadded :: next
1323+
1324+
1325+ .. method :: assertEndsWith(s, suffix, msg=None)
1326+ .. method :: assertNotEndsWith(s, suffix, msg=None)
1327+
1328+ Test that the Unicode or byte string *s * ends (or does not end)
1329+ with a *suffix *.
1330+ *suffix * can also be a tuple of strings to try.
1331+
1332+ .. versionadded :: next
1333+
1334+
1335+ .. method :: assertHasAttr(obj, name, msg=None)
1336+ .. method :: assertNotHasAttr(obj, name, msg=None)
1337+
1338+ Test that the object *obj * has (or has not) an attribute *name *.
1339+
1340+ .. versionadded :: next
1341+
1342+
12821343 .. _type-specific-methods :
12831344
12841345 The :meth: `assertEqual ` method dispatches the equality check for objects of
0 commit comments