MCPcopy Index your code
hub / github.com/python/cpython / assertIsSubclass

Method assertIsSubclass

Lib/unittest/case.py:1350–1362  ·  view source on GitHub ↗
(self, cls, superclass, msg=None)

Source from the content-addressed store, hash-verified

1348 self.fail(self._formatMessage(msg, standardMsg))
1349
1350 def assertIsSubclass(self, cls, superclass, msg=None):
1351 try:
1352 if issubclass(cls, superclass):
1353 return
1354 except TypeError:
1355 if not isinstance(cls, type):
1356 self.fail(self._formatMessage(msg, f'{cls!r} is not a class'))
1357 raise
1358 if isinstance(superclass, tuple):
1359 standardMsg = f'{cls!r} is not a subclass of any of {superclass!r}'
1360 else:
1361 standardMsg = f'{cls!r} is not a subclass of {superclass!r}'
1362 self.fail(self._formatMessage(msg, standardMsg))
1363
1364 def assertNotIsSubclass(self, cls, superclass, msg=None):
1365 try:

Callers 15

test_exceptionsMethod · 0.80
test_name_mappingMethod · 0.80
check_structseqMethod · 0.80
test_python_dictsMethod · 0.80
test_basicMethod · 0.80
test_issubclassMethod · 0.80
test_errorMethod · 0.80
testExceptionTreeMethod · 0.80

Calls 2

failMethod · 0.95
_formatMessageMethod · 0.95

Tested by 15

test_exceptionsMethod · 0.64
test_name_mappingMethod · 0.64
check_structseqMethod · 0.64
test_python_dictsMethod · 0.64
test_basicMethod · 0.64
test_issubclassMethod · 0.64
test_errorMethod · 0.64
testExceptionTreeMethod · 0.64