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

Method reset_mock

Lib/unittest/mock.py:637–666  ·  view source on GitHub ↗

Restore the mock object to its initial state.

(self, visited=None, *,
                   return_value: bool = False,
                   side_effect: bool = False)

Source from the content-addressed store, hash-verified

635
636
637 def reset_mock(self, visited=None, *,
638 return_value: bool = False,
639 side_effect: bool = False):
640 "Restore the mock object to its initial state."
641 if visited is None:
642 visited = []
643 if id(self) in visited:
644 return
645 visited.append(id(self))
646
647 self.called = False
648 self.call_args = None
649 self.call_count = 0
650 self.mock_calls = _CallList()
651 self.call_args_list = _CallList()
652 self.method_calls = _CallList()
653
654 if return_value:
655 self._mock_return_value = DEFAULT
656 if side_effect:
657 self._mock_side_effect = None
658
659 for child in self._mock_children.values():
660 if isinstance(child, _SpecState) or child is _deleted:
661 continue
662 child.reset_mock(visited, return_value=return_value, side_effect=side_effect)
663
664 ret = self._mock_return_value
665 if _is_instance_mock(ret) and ret is not self:
666 ret.reset_mock(visited)
667
668
669 def configure_mock(self, /, **kwargs):

Callers

nothing calls this directly

Calls 7

idFunction · 0.85
_CallListClass · 0.85
isinstanceFunction · 0.85
_is_instance_mockFunction · 0.85
appendMethod · 0.45
valuesMethod · 0.45
reset_mockMethod · 0.45

Tested by

no test coverage detected