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

Method cannot_set_attr

Lib/test/test_funcattrs.py:33–45  ·  view source on GitHub ↗
(self, obj, name, value, exceptions)

Source from the content-addressed store, hash-verified

31 self.b = b
32
33 def cannot_set_attr(self, obj, name, value, exceptions):
34 try:
35 setattr(obj, name, value)
36 except exceptions:
37 pass
38 else:
39 self.fail("shouldn't be able to set %s to %r" % (name, value))
40 try:
41 delattr(obj, name)
42 except exceptions:
43 pass
44 else:
45 self.fail("shouldn't be able to del %s" % name)
46
47
48class FunctionPropertiesTest(FuncAttrsTest):

Callers 11

test___globals__Method · 0.80
test___builtins__Method · 0.80
test___closure__Method · 0.80
test___name__Method · 0.80
test___qualname__Method · 0.80
test___class__Method · 0.80
test___func__Method · 0.80
test___self__Method · 0.80

Calls 1

failMethod · 0.45

Tested by

no test coverage detected