MCPcopy Create free account
hub / github.com/apache/fory / file_roundtrip

Function file_roundtrip

integration_tests/idl_tests/python/idl_tests/roundtrip.py:156–164  ·  view source on GitHub ↗
(fory: pyfory.Fory, book: "addressbook.AddressBook")

Source from the content-addressed store, hash-verified

154
155
156def file_roundtrip(fory: pyfory.Fory, book: "addressbook.AddressBook") -> None:
157 data_file = os.environ.get("DATA_FILE")
158 if not data_file:
159 return
160 payload = Path(data_file).read_bytes()
161 decoded = fory.deserialize(payload)
162 assert isinstance(decoded, addressbook.AddressBook)
163 assert decoded == book
164 Path(data_file).write_bytes(fory.serialize(decoded))
165
166
167def local_roundtrip_auto_id(fory: pyfory.Fory, envelope: "auto_id.Envelope") -> None:

Callers 1

run_roundtripFunction · 0.85

Calls 5

getMethod · 0.65
deserializeMethod · 0.65
serializeMethod · 0.65
read_bytesMethod · 0.45
write_bytesMethod · 0.45

Tested by

no test coverage detected