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

Method test_headers_debuglevel

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

Source from the content-addressed store, hash-verified

370 conn.putheader(name, value)
371
372 def test_headers_debuglevel(self):
373 body = (
374 b'HTTP/1.1 200 OK\r\n'
375 b'First: val\r\n'
376 b'Second: val1\r\n'
377 b'Second: val2\r\n'
378 )
379 sock = FakeSocket(body)
380 resp = client.HTTPResponse(sock, debuglevel=1)
381 with support.captured_stdout() as output:
382 resp.begin()
383 lines = output.getvalue().splitlines()
384 self.assertEqual(lines[0], "reply: 'HTTP/1.1 200 OK\\r\\n'")
385 self.assertEqual(lines[1], "header: First: val")
386 self.assertEqual(lines[2], "header: Second: val1")
387 self.assertEqual(lines[3], "header: Second: val2")
388
389 def test_max_response_headers(self):
390 max_headers = client._MAXHEADERS + 20

Callers

nothing calls this directly

Calls 5

beginMethod · 0.95
FakeSocketClass · 0.70
splitlinesMethod · 0.45
getvalueMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected