(self)
| 879 | self.assertTrue(resp.closed) |
| 880 | |
| 881 | def test_partial_readintos_past_end(self): |
| 882 | # if we have Content-Length, clip readintos to the end |
| 883 | body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText" |
| 884 | sock = FakeSocket(body) |
| 885 | resp = client.HTTPResponse(sock) |
| 886 | resp.begin() |
| 887 | b = bytearray(10) |
| 888 | n = resp.readinto(b) |
| 889 | self.assertEqual(n, 4) |
| 890 | self.assertEqual(bytes(b)[:4], b'Text') |
| 891 | self.assertTrue(resp.isclosed()) |
| 892 | self.assertFalse(resp.closed) |
| 893 | resp.close() |
| 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 |
nothing calls this directly
no test coverage detected