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

Method assertNotHasAttr

Lib/unittest/case.py:1390–1398  ·  view source on GitHub ↗
(self, obj, name, msg=None)

Source from the content-addressed store, hash-verified

1388 self.fail(self._formatMessage(msg, standardMsg))
1389
1390 def assertNotHasAttr(self, obj, name, msg=None):
1391 if hasattr(obj, name):
1392 if isinstance(obj, types.ModuleType):
1393 standardMsg = f'module {obj.__name__!r} has unexpected attribute {name!r}'
1394 elif isinstance(obj, type):
1395 standardMsg = f'type object {obj.__name__!r} has unexpected attribute {name!r}'
1396 else:
1397 standardMsg = f'{type(obj).__name__!r} object has unexpected attribute {name!r}'
1398 self.fail(self._formatMessage(msg, standardMsg))
1399
1400 def assertRaisesRegex(self, expected_exception, expected_regex,
1401 *args, **kwargs):

Callers 15

test_class_markerMethod · 0.95
test_class_attrsMethod · 0.95
test_copyingMethod · 0.80
test_no_updateMethod · 0.80
test_no_updateMethod · 0.80
test_method_registerMethod · 0.80
test_copy_pickleMethod · 0.80
test_metaclassMethod · 0.80
test_object_classMethod · 0.80

Calls 2

failMethod · 0.95
_formatMessageMethod · 0.95

Tested by 15

test_class_markerMethod · 0.76
test_class_attrsMethod · 0.76
test_copyingMethod · 0.64
test_no_updateMethod · 0.64
test_no_updateMethod · 0.64
test_method_registerMethod · 0.64
test_copy_pickleMethod · 0.64
test_metaclassMethod · 0.64
test_object_classMethod · 0.64