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

Method assertNotIsSubclass

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

Source from the content-addressed store, hash-verified

1362 self.fail(self._formatMessage(msg, standardMsg))
1363
1364 def assertNotIsSubclass(self, cls, superclass, msg=None):
1365 try:
1366 if not issubclass(cls, superclass):
1367 return
1368 except TypeError:
1369 if not isinstance(cls, type):
1370 self.fail(self._formatMessage(msg, f'{cls!r} is not a class'))
1371 raise
1372 if isinstance(superclass, tuple):
1373 for x in superclass:
1374 if issubclass(cls, x):
1375 superclass = x
1376 break
1377 standardMsg = f'{cls!r} is a subclass of {superclass!r}'
1378 self.fail(self._formatMessage(msg, standardMsg))
1379
1380 def assertHasAttr(self, obj, name, msg=None):
1381 if not hasattr(obj, name):

Calls 2

failMethod · 0.95
_formatMessageMethod · 0.95