diff options
| author | Erik Tollerud <erik.tollerud@gmail.com> | 2014-07-22 19:42:50 -0400 |
|---|---|---|
| committer | Erik Tollerud <erik.tollerud@gmail.com> | 2014-08-10 16:45:34 -0400 |
| commit | 50993ef81205900b4c985a4721d99f2eed045463 (patch) | |
| tree | 1fef7ebe329cec7b0c6d0eafba179d6335110757 /test/test_response.py | |
| parent | ae2241520329c289a5bae158ff8433c56c1906eb (diff) | |
| download | urllib3-50993ef81205900b4c985a4721d99f2eed045463.tar.gz | |
Add test for buffering behavior
Diffstat (limited to 'test/test_response.py')
| -rw-r--r-- | test/test_response.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_response.py b/test/test_response.py index ad134ee3..29cf0d00 100644 --- a/test/test_response.py +++ b/test/test_response.py @@ -182,6 +182,14 @@ class TestResponse(unittest.TestCase): br.close() self.assertEqual(resp.closed, True) + b = b'fooandahalf' + fp = BytesIO(bytes(b)) + resp = HTTPResponse(fp, preload_content=False) + br = BufferedReader(resp, 5) + + br.read(1) # sets up the buffer, reading 5 + self.assertEqual(len(fp.read()), len(b) - 5) + def test_streaming(self): fp = BytesIO(b'foo') resp = HTTPResponse(fp, preload_content=False) |
