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

Method assertNotIsInstance

Lib/unittest/case.py:1339–1348  ·  view source on GitHub ↗

Included for symmetry with assertIsInstance.

(self, obj, cls, msg=None)

Source from the content-addressed store, hash-verified

1337 self.fail(self._formatMessage(msg, standardMsg))
1338
1339 def assertNotIsInstance(self, obj, cls, msg=None):
1340 """Included for symmetry with assertIsInstance."""
1341 if isinstance(obj, cls):
1342 if isinstance(cls, tuple):
1343 for x in cls:
1344 if isinstance(obj, x):
1345 cls = x
1346 break
1347 standardMsg = f'{safe_repr(obj)} is an instance of {cls!r}'
1348 self.fail(self._formatMessage(msg, standardMsg))
1349
1350 def assertIsSubclass(self, cls, superclass, msg=None):
1351 try:

Callers 15

test_not_hashableMethod · 0.80
test_hashMethod · 0.80
test_booleanMethod · 0.80
test_iter_keysMethod · 0.80
test_iter_valuesMethod · 0.80
test_iter_itemsMethod · 0.80
test_data_connectionMethod · 0.80

Calls 3

failMethod · 0.95
_formatMessageMethod · 0.95
safe_reprFunction · 0.85

Tested by 15

test_not_hashableMethod · 0.64
test_hashMethod · 0.64
test_booleanMethod · 0.64
test_iter_keysMethod · 0.64
test_iter_valuesMethod · 0.64
test_iter_itemsMethod · 0.64
test_data_connectionMethod · 0.64