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

Function test_serialize_complex_struct

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

Source from the content-addressed store, hash-verified

526
527@cross_language_test
528def test_serialize_complex_struct(data_file_path):
529 compatible = "compatible" in data_file_path
530 fory = pyfory.Fory(xlang=True, ref=True, compatible=compatible)
531 fory.register_type(ComplexObject1, name="test.ComplexObject1")
532 fory.register_type(ComplexObject2, name="test.ComplexObject2")
533
534 obj2 = ComplexObject2(f1=True, f2={-1: 2})
535 obj1 = ComplexObject1(
536 f1=obj2,
537 f2="abc",
538 f3=["abc", "abc"],
539 f4={1: 2},
540 f5=2**7 - 1,
541 f6=2**15 - 1,
542 f7=2**31 - 1,
543 f8=2**63 - 1,
544 f9=1.0 / 2,
545 f10=1 / 3.0,
546 f11=array.array("h", [1, 2]),
547 f12=[-1, 4],
548 )
549 struct_round_back(data_file_path, fory, obj1)
550
551
552def _deep_equal(left, right):

Callers

nothing calls this directly

Calls 6

register_typeMethod · 0.95
struct_round_backFunction · 0.85
ComplexObject2Class · 0.70
ComplexObject1Class · 0.70
ForyMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected