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

Method decorate_class

Lib/unittest/mock.py:1399–1410  ·  view source on GitHub ↗
(self, klass)

Source from the content-addressed store, hash-verified

1397
1398
1399 def decorate_class(self, klass):
1400 for attr in dir(klass):
1401 if not attr.startswith(patch.TEST_PREFIX):
1402 continue
1403
1404 attr_value = getattr(klass, attr)
1405 if not hasattr(attr_value, "__call__"):
1406 continue
1407
1408 patcher = self.copy()
1409 setattr(klass, attr, patcher(attr_value))
1410 return klass
1411
1412
1413 @contextlib.contextmanager

Callers 1

__call__Method · 0.95

Calls 2

copyMethod · 0.95
startswithMethod · 0.45

Tested by

no test coverage detected