MCPcopy Create free account
hub / github.com/scanny/python-pptx / it_can_write_a_blob

Method it_can_write_a_blob

tests/opc/test_serialized.py:326–336  ·  view source on GitHub ↗

Integrates with zipfile.ZipFile.

(self, _zipf_prop_: Mock)

Source from the content-addressed store, hash-verified

324 _zipf_prop_.return_value.close.assert_called_once_with()
325
326 def it_can_write_a_blob(self, _zipf_prop_: Mock):
327 """Integrates with zipfile.ZipFile."""
328 pack_uri = PackURI("/part/name.xml")
329 _zipf_prop_.return_value = zipf = zipfile.ZipFile(io.BytesIO(), "w")
330 pkg_writer = _ZipPkgWriter("")
331
332 pkg_writer.write(pack_uri, b"blob")
333
334 members = {PackURI("/%s" % name): zipf.read(name) for name in zipf.namelist()}
335 assert len(members) == 1
336 assert members[pack_uri] == b"blob"
337
338 def it_provides_access_to_the_open_zip_file_to_help(self, request: FixtureRequest):
339 ZipFile_ = class_mock(request, "pptx.opc.serialized.zipfile.ZipFile")

Callers

nothing calls this directly

Calls 4

PackURIClass · 0.90
_ZipPkgWriterClass · 0.90
readMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected