diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-06 08:37:19 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-06 08:37:19 (GMT) |
commit | daf990f8a79820e6e91ab5fa98a873e179d7602f (patch) | |
tree | 598d732e0a63a7678e239704fc51c6598f9f94a7 /Lib/test/test_httplib.py | |
parent | da23259f992a5f962fa9f95acb6608c2ecada348 (diff) | |
parent | b6c86fd87f93f73c8d5f759d3f5136f1a1cc67e9 (diff) | |
download | cpython-daf990f8a79820e6e91ab5fa98a873e179d7602f.zip cpython-daf990f8a79820e6e91ab5fa98a873e179d7602f.tar.gz cpython-daf990f8a79820e6e91ab5fa98a873e179d7602f.tar.bz2 |
Issue #16723: httplib.HTTPResponse no longer marked closed when the connection
is automatically closed.
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r-- | Lib/test/test_httplib.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index be2d771..a2f141e 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -166,6 +166,9 @@ class BasicTest(TestCase): resp.begin() self.assertEqual(resp.read(), b"Text") self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) @@ -187,6 +190,9 @@ class BasicTest(TestCase): self.assertFalse(resp.isclosed()) self.assertEqual(resp.read(2), b'xt') self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) def test_partial_readintos(self): # if we have a length, the system knows when to close itself @@ -204,6 +210,9 @@ class BasicTest(TestCase): self.assertEqual(n, 2) self.assertEqual(bytes(b), b'xt') self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) def test_partial_reads_no_content_length(self): # when no length is present, the socket should be gracefully closed when @@ -217,6 +226,9 @@ class BasicTest(TestCase): self.assertEqual(resp.read(2), b'xt') self.assertEqual(resp.read(1), b'') self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) def test_partial_readintos_no_content_length(self): # when no length is present, the socket should be gracefully closed when @@ -268,6 +280,9 @@ class BasicTest(TestCase): n = resp.readinto(b) self.assertEqual(n, 0) self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) def test_host_port(self): # Check invalid host_port @@ -495,6 +510,9 @@ class BasicTest(TestCase): self.assertEqual(resp.status, 200) self.assertEqual(resp.reason, 'OK') self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) def test_readinto_chunked_head(self): chunked_start = ( @@ -515,6 +533,9 @@ class BasicTest(TestCase): self.assertEqual(resp.status, 200) self.assertEqual(resp.reason, 'OK') self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) def test_negative_content_length(self): sock = FakeSocket( @@ -590,6 +611,9 @@ class BasicTest(TestCase): resp.begin() self.assertEqual(resp.read(), b'') self.assertTrue(resp.isclosed()) + self.assertFalse(resp.closed) + resp.close() + self.assertTrue(resp.closed) def test_delayed_ack_opt(self): # Test that Nagle/delayed_ack optimistaion works correctly. |