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

Function test_encoder_without_schema

python/pyfory/tests/test_cross_language.py:160–172  ·  view source on GitHub ↗
(data_file_path)

Source from the content-addressed store, hash-verified

158
159@cross_language_test
160def test_encoder_without_schema(data_file_path):
161 encoder = pyfory.encoder(FooPOJO)
162 debug_print(encoder)
163 foo = create_foo(foo_cls=FooPOJO, bar_cls=BarPOJO)
164 with open(data_file_path, "rb+") as f:
165 data_bytes = f.read()
166 obj = encoder.decode(data_bytes)
167 debug_print("deserialized foo", obj)
168 # Compare by dict since decoder returns a record class, not the original class
169 assert to_dict(obj) == to_dict(foo)
170 f.seek(0)
171 f.truncate()
172 f.write(encoder.encode(foo))
173
174
175@cross_language_test

Callers

nothing calls this directly

Calls 7

to_dictFunction · 0.85
debug_printFunction · 0.70
create_fooFunction · 0.70
readMethod · 0.65
decodeMethod · 0.65
writeMethod · 0.65
encodeMethod · 0.65

Tested by

no test coverage detected