MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_read1_bound_content_length

Method test_read1_bound_content_length

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

Source from the content-addressed store, hash-verified

1417 resp.close()
1418
1419 def test_read1_bound_content_length(self):
1420 extradata = b"extradata"
1421 expected = b"Hello123\r\n"
1422 sock = FakeSocket(b'HTTP/1.1 200 OK\r\nContent-Length: 30\r\n\r\n' + expected*3 + extradata)
1423 resp = client.HTTPResponse(sock, method="GET")
1424 resp.begin()
1425 self.assertEqual(resp.read1(20), expected*2)
1426 self.assertEqual(resp.read(), expected)
1427 # the file should now have our extradata ready to be read
1428 self.assertEqual(sock.file.read(), extradata) #we read to the end
1429 resp.close()
1430
1431 def test_response_fileno(self):
1432 # Make sure fd returned by fileno is valid.

Callers

nothing calls this directly

Calls 7

beginMethod · 0.95
read1Method · 0.95
readMethod · 0.95
closeMethod · 0.95
FakeSocketClass · 0.70
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected