MCPcopy
hub / github.com/encode/httpx / test_zstd_multiframe

Function test_zstd_multiframe

tests/test_decoders.py:122–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120
121
122def test_zstd_multiframe():
123 # test inspired by urllib3 test suite
124 data = (
125 # Zstandard frame
126 zstd.compress(b"foo")
127 # skippable frame (must be ignored)
128 + bytes.fromhex(
129 "50 2A 4D 18" # Magic_Number (little-endian)
130 "07 00 00 00" # Frame_Size (little-endian)
131 "00 00 00 00 00 00 00" # User_Data
132 )
133 # Zstandard frame
134 + zstd.compress(b"bar")
135 )
136 compressed_body = io.BytesIO(data)
137
138 headers = [(b"Content-Encoding", b"zstd")]
139 response = httpx.Response(200, headers=headers, content=compressed_body)
140 response.read()
141 assert response.content == b"foobar"
142
143
144def test_multi():

Callers

nothing calls this directly

Calls 1

readMethod · 0.95

Tested by

no test coverage detected