[New-bugs-announce] [issue26807] mock_open()().readline() fails at EOF

Robert Collins report at bugs.python.org
Wed Apr 20 04:18:03 EDT 2016


New submission from Robert Collins:

>>> import unittest.mock
>>> o = unittest.mock.mock_open(read_data="fred")
>>> f = o()
>>> f.read()
'fred'
>>> f.read()
''
>>> f.readlines()
[]
>>> f.readline()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/robertc/work/cpython/Lib/unittest/mock.py", line 935, in __call__
    return _mock_self._mock_call(*args, **kwargs)
  File "/home/robertc/work/cpython/Lib/unittest/mock.py", line 994, in _mock_call
    result = next(effect)
StopIteration

----------
components: Library (Lib)
messages: 263814
nosy: rbcollins
priority: normal
severity: normal
stage: test needed
status: open
title: mock_open()().readline() fails at EOF
type: behavior
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26807>
_______________________________________


More information about the New-bugs-announce mailing list