From 5a8bc193844b1d46d89784c11e62b3a4882afa25 Mon Sep 17 00:00:00 2001 From: Vincent Barbaresi Date: Wed, 15 Mar 2017 00:52:32 +0100 Subject: [PATCH] add more tests for iter_lines() check the case of an empty chunk somewhere in the stream --- tests/test_requests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index 96769830..ac4bc2d5 100755 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -1345,12 +1345,15 @@ class TestRequests: (['line\n'], ['line'], ['line\n']), (['line', '\n'], ['line'], ['line\n']), (['line\r\n'], ['line'], ['line', '']), + # Empty chunk in the end of stream, same behavior as the previous + (['line\r\n', ''], ['line'], ['line', '']), (['line', '\r\n'], ['line'], ['line', '']), (['a\r', '\nb\r'], ['a', '', 'b'], ['a', 'b\r']), (['a\n', '\nb'], ['a', '', 'b'], ['a\n\nb']), (['a\r\n','\rb\n'], ['a', '', 'b'], ['a', '\rb\n']), (['a\nb', 'c'], ['a', 'bc'], ['a\nbc']), - (['a\n', '\rb', '\r\nc'], ['a', '', 'b', 'c'], ['a\n\rb', 'c']) + (['a\n', '\rb', '\r\nc'], ['a', '', 'b', 'c'], ['a\n\rb', 'c']), + (['a\r\nb', '', 'c'], ['a', 'bc'], ['a', 'bc']) # Empty chunk with pending data )) def test_response_lines_parametrized(self, content, expected_no_delimiter, expected_delimiter): """