pypy/module/_io/test/test_interp_textio.py::test_readline
space = StdObjSpace
@given(data=st_readline(),
> mode=st.sampled_from(['\r', '\n', '\r\n', '']))
@settings(deadline=None, database=None)
@example(data=(u'\n\r\n', [0, -1, 2, -1, 0, -1]), mode='\r')
def test_readline(space, data, mode):
module/_io/test/test_interp_textio.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../virt_test/lib/python2.7/site-packages/hypothesis/core.py:563: in execute
result = self.test_runner(data, run)
../virt_test/lib/python2.7/site-packages/hypothesis/executors.py:56: in default_new_style_executor
return function(data)
../virt_test/lib/python2.7/site-packages/hypothesis/core.py:561: in run
return test(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, data = (u'\ud800\udc00\n', [0, -1]), mode = '\r'
@given(data=st_readline(),
mode=st.sampled_from(['\r', '\n', '\r\n', '']))
@settings(deadline=None, database=None)
@example(data=(u'\n\r\n', [0, -1, 2, -1, 0, -1]), mode='\r')
def test_readline(space, data, mode):
txt, limits = data
w_stream = W_BytesIO(space)
w_stream.descr_init(space, space.newbytes(txt.encode('utf-8')))
w_textio = W_TextIOWrapper(space)
w_textio.descr_init(
space, w_stream,
encoding='utf-8', w_errors=space.newtext('surrogatepass'),
w_newline=space.newtext(mode))
lines = []
for limit in limits:
w_line = w_textio.readline_w(space, space.newint(limit))
line = space.utf8_w(w_line).decode('utf-8')
if limit >= 0:
assert len(line) <= limit
if line:
lines.append(line)
elif limit:
break
> assert txt.startswith(u''.join(lines))
E assert <built-in method startswith of unicode object at 0xf1236a40>(u'\U00010000\n')
E + where <built-in method startswith of unicode object at 0xf1236a40> = u'\ud800\udc00\n'.startswith
E + and u'\U00010000\n' = <built-in method join of unicode object at 0xf7ab30f8>([u'\U00010000\n'])
E + where <built-in method join of unicode object at 0xf7ab30f8> = u''.join
module/_io/test/test_interp_textio.py:58: AssertionError
---------- Hypothesis ----------
Falsifying example: test_readline(space=StdObjSpace, data=(u'\ud800\udc00\n', [0, -1]), mode='\r')
builder: own-linux-x86-32 build #9417+
test: pypy/module/_io/test/test_interp_textio.py::test_readline