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

Method __exit__

Lib/unittest/mock.py:1633–1655  ·  view source on GitHub ↗

Undo the patch.

(self, *exc_info)

Source from the content-addressed store, hash-verified

1631 raise
1632
1633 def __exit__(self, *exc_info):
1634 """Undo the patch."""
1635 if not self.is_started:
1636 return
1637
1638 if self.is_local and self.temp_original is not DEFAULT:
1639 setattr(self.target, self.attribute, self.temp_original)
1640 else:
1641 delattr(self.target, self.attribute)
1642 if not self.create and (not hasattr(self.target, self.attribute) or
1643 self.attribute in ('__doc__', '__module__',
1644 '__defaults__', '__annotations__',
1645 '__kwdefaults__')):
1646 # needed for proxy objects like django settings
1647 setattr(self.target, self.attribute, self.temp_original)
1648
1649 del self.temp_original
1650 del self.is_local
1651 del self.target
1652 exit_stack = self._exit_stack
1653 del self._exit_stack
1654 self.is_started = False
1655 return exit_stack.__exit__(*exc_info)
1656
1657
1658 def start(self):

Callers 2

__enter__Method · 0.95
stopMethod · 0.95

Calls 3

setattrFunction · 0.85
delattrFunction · 0.85
hasattrFunction · 0.85

Tested by

no test coverage detected