MCPcopy Index your code
hub / github.com/python/cpython / test_status_lines

Method test_status_lines

Lib/test/test_httplib.py:794–813  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

792 self.assertFalse(category_indicator)
793
794 def test_status_lines(self):
795 # Test HTTP status lines
796
797 body = "HTTP/1.1 200 Ok\r\n\r\nText"
798 sock = FakeSocket(body)
799 resp = client.HTTPResponse(sock)
800 resp.begin()
801 self.assertEqual(resp.read(0), b'') # Issue #20007
802 self.assertFalse(resp.isclosed())
803 self.assertFalse(resp.closed)
804 self.assertEqual(resp.read(), b"Text")
805 self.assertTrue(resp.isclosed())
806 self.assertFalse(resp.closed)
807 resp.close()
808 self.assertTrue(resp.closed)
809
810 body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText"
811 sock = FakeSocket(body)
812 resp = client.HTTPResponse(sock)
813 self.assertRaises(client.BadStatusLine, resp.begin)
814
815 def test_bad_status_repr(self):
816 exc = client.BadStatusLine('')

Callers

nothing calls this directly

Calls 9

beginMethod · 0.95
readMethod · 0.95
isclosedMethod · 0.95
closeMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80
FakeSocketClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected