MCPcopy Index your code
hub / github.com/RustPython/RustPython / _mock_set_magics

Method _mock_set_magics

Lib/unittest/mock.py:2180–2198  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2178
2179
2180 def _mock_set_magics(self):
2181 orig_magics = _magics | _async_method_magics
2182 these_magics = orig_magics
2183
2184 if getattr(self, "_mock_methods", None) is not None:
2185 these_magics = orig_magics.intersection(self._mock_methods)
2186 remove_magics = orig_magics - these_magics
2187
2188 for entry in remove_magics:
2189 if entry in type(self).__dict__:
2190 # remove unneeded magic methods
2191 delattr(self, entry)
2192
2193 # don't overwrite existing attributes if called a second time
2194 these_magics = these_magics - set(type(self).__dict__)
2195
2196 _type = type(self)
2197 for entry in these_magics:
2198 setattr(_type, entry, MagicProxy(entry, self))
2199
2200
2201

Callers 3

__init__Method · 0.95
mock_add_specMethod · 0.80
mock_add_specMethod · 0.80

Calls 6

getattrFunction · 0.85
delattrFunction · 0.85
setFunction · 0.85
setattrFunction · 0.85
MagicProxyClass · 0.85
intersectionMethod · 0.45

Tested by

no test coverage detected