summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorTony Flury <anthony.flury@btinternet.com>2018-09-12 22:21:16 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2018-09-12 22:21:16 (GMT)
commit2087023fdec2c89070bd14f384a3c308c548a94a (patch)
treeadc1cfdebd6ed15525044cb09d83188d511831c9 /Doc
parentc7042224b8a67748f125c22836862483f81a87a6 (diff)
downloadcpython-2087023fdec2c89070bd14f384a3c308c548a94a.zip
cpython-2087023fdec2c89070bd14f384a3c308c548a94a.tar.gz
cpython-2087023fdec2c89070bd14f384a3c308c548a94a.tar.bz2
bpo-32933: Implement __iter__ method on mock_open() (GH-5974)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/unittest.mock.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index fd4e067..d1b18d0 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -2095,6 +2095,10 @@ mock_open
.. versionchanged:: 3.5
*read_data* is now reset on each call to the *mock*.
+ .. versionchanged:: 3.8
+ Added :meth:`__iter__` to implementation so that iteration (such as in for
+ loops) correctly consumes *read_data*.
+
Using :func:`open` as a context manager is a great way to ensure your file handles
are closed properly and is becoming common::