MCPcopy
hub / github.com/pallets/werkzeug / test_stream_zip

Function test_stream_zip

tests/test_wrappers.py:1222–1232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1220
1221
1222def test_stream_zip():
1223 import zipfile
1224
1225 response = wrappers.Response()
1226 with contextlib.closing(zipfile.ZipFile(response.stream, mode="w")) as z:
1227 z.writestr("foo", b"bar")
1228
1229 buffer = BytesIO(response.get_data())
1230 with contextlib.closing(zipfile.ZipFile(buffer, mode="r")) as z:
1231 assert z.namelist() == ["foo"]
1232 assert z.read("foo") == b"bar"
1233
1234
1235class TestSetCookie:

Callers

nothing calls this directly

Calls 2

get_dataMethod · 0.95
readMethod · 0.45

Tested by

no test coverage detected