MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __exit__

Method __exit__

tools/python-3.11.9-amd64/Lib/unittest/mock.py:1571–1589  ·  view source on GitHub ↗

Undo the patch.

(self, *exc_info)

Source from the content-addressed store, hash-verified

1569 raise
1570
1571 def __exit__(self, *exc_info):
1572 """Undo the patch."""
1573 if self.is_local and self.temp_original is not DEFAULT:
1574 setattr(self.target, self.attribute, self.temp_original)
1575 else:
1576 delattr(self.target, self.attribute)
1577 if not self.create and (not hasattr(self.target, self.attribute) or
1578 self.attribute in ('__doc__', '__module__',
1579 '__defaults__', '__annotations__',
1580 '__kwdefaults__')):
1581 # needed for proxy objects like django settings
1582 setattr(self.target, self.attribute, self.temp_original)
1583
1584 del self.temp_original
1585 del self.is_local
1586 del self.target
1587 exit_stack = self._exit_stack
1588 del self._exit_stack
1589 return exit_stack.__exit__(*exc_info)
1590
1591
1592 def start(self):

Callers 2

__enter__Method · 0.95
stopMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected