(self)
| 771 | self.assertEqual(repr(exc), '''BadStatusLine("''")''') |
| 772 | |
| 773 | def test_partial_reads(self): |
| 774 | # if we have Content-Length, HTTPResponse knows when to close itself, |
| 775 | # the same behaviour as when we read the whole thing with read() |
| 776 | body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText" |
| 777 | sock = FakeSocket(body) |
| 778 | resp = client.HTTPResponse(sock) |
| 779 | resp.begin() |
| 780 | self.assertEqual(resp.read(2), b'Te') |
| 781 | self.assertFalse(resp.isclosed()) |
| 782 | self.assertEqual(resp.read(2), b'xt') |
| 783 | self.assertTrue(resp.isclosed()) |
| 784 | self.assertFalse(resp.closed) |
| 785 | resp.close() |
| 786 | self.assertTrue(resp.closed) |
| 787 | |
| 788 | def test_mixed_reads(self): |
| 789 | # readline() should update the remaining length, so that read() knows |
nothing calls this directly
no test coverage detected