(self)
| 894 | self.assertTrue(resp.closed) |
| 895 | |
| 896 | def test_partial_reads_no_content_length(self): |
| 897 | # when no length is present, the socket should be gracefully closed when |
| 898 | # all data was read |
| 899 | body = "HTTP/1.1 200 Ok\r\n\r\nText" |
| 900 | sock = FakeSocket(body) |
| 901 | resp = client.HTTPResponse(sock) |
| 902 | resp.begin() |
| 903 | self.assertEqual(resp.read(2), b'Te') |
| 904 | self.assertFalse(resp.isclosed()) |
| 905 | self.assertEqual(resp.read(2), b'xt') |
| 906 | self.assertEqual(resp.read(1), b'') |
| 907 | self.assertTrue(resp.isclosed()) |
| 908 | self.assertFalse(resp.closed) |
| 909 | resp.close() |
| 910 | self.assertTrue(resp.closed) |
| 911 | |
| 912 | def test_partial_readintos_no_content_length(self): |
| 913 | # when no length is present, the socket should be gracefully closed when |
nothing calls this directly
no test coverage detected