@@ -397,6 +397,8 @@ the *new_callable* argument to :func:`patch`.
397397
398398 The reset_mock method resets all the call attributes on a mock object:
399399
400+ .. doctest ::
401+
400402 >>> mock = Mock(return_value = None )
401403 >>> mock(' hello' )
402404 >>> mock.called
@@ -405,20 +407,41 @@ the *new_callable* argument to :func:`patch`.
405407 >>> mock.called
406408 False
407409
408- .. versionchanged :: 3.6
409- Added two keyword-only arguments to the reset_mock function.
410-
411410 This can be useful where you want to make a series of assertions that
412- reuse the same object. Note that :meth: `reset_mock ` *doesn't * clear the
411+ reuse the same object.
412+
413+ *return_value * parameter when set to ``True `` resets :attr: `return_value `:
414+
415+ .. doctest ::
416+
417+ >>> mock = Mock(return_value = 5 )
418+ >>> mock(' hello' )
419+ 5
420+ >>> mock.reset_mock(return_value = True )
421+ >>> mock(' hello' ) # doctest: +ELLIPSIS
422+ <Mock name='mock()' id='...'>
423+
424+ *side_effect * parameter when set to ``True `` resets :attr: `side_effect `:
425+
426+ .. doctest ::
427+
428+ >>> mock = Mock(side_effect = ValueError )
429+ >>> mock(' hello' )
430+ Traceback (most recent call last):
431+ ...
432+ ValueError
433+ >>> mock.reset_mock(side_effect = True )
434+ >>> mock(' hello' ) # doctest: +ELLIPSIS
435+ <Mock name='mock()' id='...'>
436+
437+ Note that :meth: `reset_mock ` *doesn't * clear the
413438 :attr: `return_value `, :attr: `side_effect ` or any child attributes you have
414- set using normal assignment by default. In case you want to reset
415- :attr: `return_value ` or :attr: `side_effect `, then pass the corresponding
416- parameter as ``True ``. Child mocks and the return value mock
417- (if any) are reset as well.
439+ set using normal assignment by default.
418440
419- .. note :: *return_value*, and *side_effect* are keyword-only
420- arguments.
441+ Child mocks are reset as well.
421442
443+ .. versionchanged :: 3.6
444+ Added two keyword-only arguments to the reset_mock function.
422445
423446 .. method :: mock_add_spec(spec, spec_set=False)
424447
0 commit comments