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

Method test_send_file

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

Source from the content-addressed store, hash-verified

1036 r"got more than \d+ headers", r.begin)
1037
1038 def test_send_file(self):
1039 expected = (b'GET /foo HTTP/1.1\r\nHost: example.com\r\n'
1040 b'Accept-Encoding: identity\r\n'
1041 b'Transfer-Encoding: chunked\r\n'
1042 b'\r\n')
1043
1044 with open(__file__, 'rb') as body:
1045 conn = client.HTTPConnection('example.com')
1046 sock = FakeSocket(body)
1047 conn.sock = sock
1048 conn.request('GET', '/foo', body)
1049 self.assertStartsWith(sock.data, expected)
1050
1051 def test_send(self):
1052 expected = b'this is a test this is only a test'

Callers

nothing calls this directly

Calls 4

requestMethod · 0.95
assertStartsWithMethod · 0.80
FakeSocketClass · 0.70
openFunction · 0.50

Tested by

no test coverage detected