(self)
| 817 | self.assertEqual(repr(exc), '''BadStatusLine("''")''') |
| 818 | |
| 819 | def test_partial_reads(self): |
| 820 | # if we have Content-Length, HTTPResponse knows when to close itself, |
| 821 | # the same behaviour as when we read the whole thing with read() |
| 822 | body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText" |
| 823 | sock = FakeSocket(body) |
| 824 | resp = client.HTTPResponse(sock) |
| 825 | resp.begin() |
| 826 | self.assertEqual(resp.read(2), b'Te') |
| 827 | self.assertFalse(resp.isclosed()) |
| 828 | self.assertEqual(resp.read(2), b'xt') |
| 829 | self.assertTrue(resp.isclosed()) |
| 830 | self.assertFalse(resp.closed) |
| 831 | resp.close() |
| 832 | self.assertTrue(resp.closed) |
| 833 | |
| 834 | def test_mixed_reads(self): |
| 835 | # readline() should update the remaining length, so that read() knows |
nothing calls this directly
no test coverage detected