Berker Peksag added the comment: data_as_list = read_data.splitlines(True)
is not actually the equivalent of data_as_list = [l + sep for l in read_data.split(sep)] It will change the behavior of the _iterate_read_data helper. See the comment at https://github.com/python/cpython/blob/78d05eb847c6b8fede08ca74bb59210c00e4c599/Lib/unittest/mock.py#L2278 However, in default branch, we can simplify it to yield from read_data.splitlines(keepends=True) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23004> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com