Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(544)

#21271: reset_mock needs parameters to also reset return_value and side_effect

Can't Edit
Can't Publish+Mail
Start Review
Created:
2 years, 6 months ago by michael
Modified:
2 years, 6 months ago
Reviewers:
berker.peksag
CC:
Michael Foord, Claudiu.Popa, devnull_psf.upfronthosting.co.za, berkerpeksag, kushaldas
Visibility:
Public.

Patch Set 1 #

Total comments: 5

Patch Set 2 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/unittest.mock.rst View 1 2 chunks +10 lines, -2 lines 0 comments Download
Lib/unittest/mock.py View 1 2 chunks +6 lines, -1 line 0 comments Download
Lib/unittest/test/testmock/testmock.py View 1 1 chunk +18 lines, -0 lines 0 comments Download

Messages

Total messages: 1
berkerpeksag
2 years, 6 months ago #1
http://bugs.python.org/review/21271/diff/14561/Doc/library/unittest.mock.rst
File Doc/library/unittest.mock.rst (right):

http://bugs.python.org/review/21271/diff/14561/Doc/library/unittest.mock.rst#...
Doc/library/unittest.mock.rst:339: .. method:: reset_mock(return_value=False,
side_effect=False)
Needs a versionchanged directive for these arguments. Also, I'd make them
keyword-only.

http://bugs.python.org/review/21271/diff/14561/Doc/library/unittest.mock.rst#...
Doc/library/unittest.mock.rst:355: return_value or :attr:`side_effect`, then
pass the corresponding
*return_value*

http://bugs.python.org/review/21271/diff/14561/Doc/library/unittest.mock.rst#...
Doc/library/unittest.mock.rst:356: parameter as `True`. Child mocks and the
return value mock
``True``

http://bugs.python.org/review/21271/diff/14561/Lib/unittest/test/testmock/tes...
File Lib/unittest/test/testmock/testmock.py (right):

http://bugs.python.org/review/21271/diff/14561/Lib/unittest/test/testmock/tes...
Lib/unittest/test/testmock/testmock.py:1226: #Issue21271 allow resetting
return_value and side_effect
No need to add a comment for a new feature. If you want to add anyway, please
add a space after #.

http://bugs.python.org/review/21271/diff/14561/Lib/unittest/test/testmock/tes...
Lib/unittest/test/testmock/testmock.py:1229: m.reset_mock(return_value=True,
side_effect=True)
What if I just pass

    m.reset_mock(return_value=True)

or

    m.reset_mock(side_effect=True)

It would be nice to add tests for these cases.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7