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

Function test_xlang_nested_tuple_container_fields

python/pyfory/tests/test_struct.py:894–911  ·  view source on GitHub ↗
(track_ref)

Source from the content-addressed store, hash-verified

892
893@pytest.mark.parametrize("track_ref", [False, True])
894def test_xlang_nested_tuple_container_fields(track_ref):
895 fory = Fory(xlang=True, compatible=False, ref=track_ref, strict=False)
896 fory.register_type(XlangNestedTupleObject, name="example.XlangNestedTupleObject")
897 obj = XlangNestedTupleObject(
898 tuple_field=([1, 2], {"a": 1, "b": 2}),
899 list_of_tuples=[("a", 1), ("b", 2)],
900 map_of_tuples={"left": ("c", 3), "right": ("d", 4)},
901 set_of_tuples={("e", 5), ("f", 6)},
902 tuple_of_tuples=(("g", 7), ("h", 8)),
903 )
904 result = ser_de(fory, obj)
905 assert result == obj
906 assert isinstance(result.tuple_field, tuple)
907 assert all(isinstance(value, tuple) for value in result.list_of_tuples)
908 assert all(isinstance(value, tuple) for value in result.map_of_tuples.values())
909 assert all(isinstance(value, tuple) for value in result.set_of_tuples)
910 assert isinstance(result.tuple_of_tuples, tuple)
911 assert all(isinstance(value, tuple) for value in result.tuple_of_tuples)
912
913
914def test_struct_evolving_override():

Callers

nothing calls this directly

Calls 5

register_typeMethod · 0.95
ForyClass · 0.90
ser_deFunction · 0.70
valuesMethod · 0.45

Tested by

no test coverage detected