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

Method check_wrapper_attrs

Lib/test/test_decorators.py:80–94  ·  view source on GitHub ↗
(self, method_wrapper, format_str)

Source from the content-addressed store, hash-verified

78 self.assertEqual(C().foo(), 42)
79
80 def check_wrapper_attrs(self, method_wrapper, format_str):
81 def func(x):
82 return x
83 wrapper = method_wrapper(func)
84
85 self.assertIs(wrapper.__func__, func)
86 self.assertIs(wrapper.__wrapped__, func)
87
88 for attr in ('__module__', '__qualname__', '__name__',
89 '__doc__', '__annotations__'):
90 self.assertIs(getattr(wrapper, attr),
91 getattr(func, attr))
92
93 self.assertEqual(repr(wrapper), format_str.format(func))
94 return wrapper
95
96 def test_staticmethod(self):
97 wrapper = self.check_wrapper_attrs(staticmethod, '<staticmethod({!r})>')

Callers 2

test_staticmethodMethod · 0.95
test_classmethodMethod · 0.95

Calls 3

assertIsMethod · 0.45
assertEqualMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected