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

Method test_binary_file_body

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

Source from the content-addressed store, hash-verified

2271 self.assertEqual(b'4\r\nbody\r\n0\r\n\r\n', f.read())
2272
2273 def test_binary_file_body(self):
2274 self.addCleanup(os_helper.unlink, os_helper.TESTFN)
2275 with open(os_helper.TESTFN, "wb") as f:
2276 f.write(b"body\xc1")
2277 with open(os_helper.TESTFN, "rb") as f:
2278 self.conn.request("PUT", "/url", f)
2279 message, f = self.get_headers_and_fp()
2280 self.assertEqual("text/plain", message.get_content_type())
2281 self.assertIsNone(message.get_charset())
2282 self.assertEqual("chunked", message.get("Transfer-Encoding"))
2283 self.assertNotIn("Content-Length", message)
2284 self.assertEqual(b'5\r\nbody\xc1\r\n0\r\n\r\n', f.read())
2285
2286
2287class HTTPResponseTest(TestCase):

Callers

nothing calls this directly

Calls 12

get_headers_and_fpMethod · 0.95
addCleanupMethod · 0.80
get_content_typeMethod · 0.80
assertIsNoneMethod · 0.80
get_charsetMethod · 0.80
assertNotInMethod · 0.80
openFunction · 0.50
writeMethod · 0.45
requestMethod · 0.45
assertEqualMethod · 0.45
getMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected