This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest.mock-examples doc uses builtin file which is removed in Python 3
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: docs@python, methane, michael.foord, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2014-01-11 18:25 by methane, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg207908 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2014-01-11 18:25
http://docs.python.org/3.3/library/unittest.mock-examples.html#mocking-chained-calls

> Let’s assume the object it returns is ‘file-like’, so we’ll ensure that our response object uses the builtin file as its spec.

and

> >>> mock_response = Mock(spec=file)
msg208370 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-17 23:39
I think /file/open/ would work.
msg208536 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-01-20 12:32
Thanks for picking this up. /file/open/ should be fine.
msg208613 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-21 05:02
New changeset 36c9a233ebf0 by Terry Jan Reedy in branch '3.3':
Issue #20222: file is no longer a builtin in 3.x.
http://hg.python.org/cpython/rev/36c9a233ebf0
History
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64421
2014-01-21 05:03:23terry.reedysetstatus: open -> closed
type: behavior
resolution: fixed
stage: resolved
2014-01-21 05:02:37python-devsetnosy: + python-dev
messages: + msg208613
2014-01-21 04:56:07terry.reedysetassignee: docs@python -> terry.reedy
versions: - Python 3.5
2014-01-20 12:32:13michael.foordsetmessages: + msg208536
2014-01-17 23:39:13terry.reedysetnosy: + terry.reedy, michael.foord
messages: + msg208370
2014-01-11 18:25:49methanecreate