summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/mock.py
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2016-05-16 03:22:45 (GMT)
committerRobert Collins <rbtcollins@hp.com>2016-05-16 03:22:45 (GMT)
commitc85dd85f1a7fe2d019cf75e93936ad2bc94a50e2 (patch)
treefa3f327fc24335054998ac4646b43c428c05e134 /Lib/unittest/mock.py
parent2b6c032e6a93dbbe79d267c1dc4ae720e2f4a4d3 (diff)
parent9549a3e3d4be2a15c222996abff8cb97180ee9be (diff)
downloadcpython-c85dd85f1a7fe2d019cf75e93936ad2bc94a50e2.zip
cpython-c85dd85f1a7fe2d019cf75e93936ad2bc94a50e2.tar.gz
cpython-c85dd85f1a7fe2d019cf75e93936ad2bc94a50e2.tar.bz2
Issue #26807: mock_open 'files' no longer error on readline at end of file.
Patch from Yolanda Robla.
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r--Lib/unittest/mock.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 7400fb7..123c156 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -2341,6 +2341,8 @@ def mock_open(mock=None, read_data=''):
yield handle.readline.return_value
for line in _state[0]:
yield line
+ while True:
+ yield type(read_data)()
global file_spec