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

Method test___func___non_method

Lib/test/test_funcattrs.py:311–324  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

309 self.cannot_set_attr(self.fi.a, "__self__", self.fi, AttributeError)
310
311 def test___func___non_method(self):
312 # Behavior should be the same when a method is added via an attr
313 # assignment
314 self.fi.id = types.MethodType(id, self.fi)
315 self.assertEqual(self.fi.id(), id(self.fi))
316 # Test usage
317 try:
318 self.fi.id.unknown_attr
319 except AttributeError:
320 pass
321 else:
322 self.fail("using unknown attributes should raise AttributeError")
323 # Test assignment and deletion
324 self.cannot_set_attr(self.fi.id, 'unknown_attr', 2, AttributeError)
325
326
327class ArbitraryFunctionAttrTest(FuncAttrsTest):

Callers

nothing calls this directly

Calls 5

idFunction · 0.85
cannot_set_attrMethod · 0.80
assertEqualMethod · 0.45
idMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected