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

Function test_dict

python/pyfory/tests/test_serializer.py:96–114  ·  view source on GitHub ↗
(track_ref)

Source from the content-addressed store, hash-verified

94
95@pytest.mark.parametrize("track_ref", [False, True])
96def test_dict(track_ref):
97 fory = Fory(xlang=False, ref=track_ref, compatible=False)
98 assert ser_de(fory, {1: 2}) == {1: 2}
99 assert ser_de(fory, {1 / 3: 2.0}) == {1 / 3: 2.0}
100 assert ser_de(fory, {1 / 3: 2}) == {1 / 3: 2}
101 assert ser_de(fory, {"1": 2}) == {"1": 2}
102 assert ser_de(fory, {"1": 1 / 3}) == {"1": 1 / 3}
103 assert ser_de(fory, {"1": {}}) == {"1": {}}
104 assert ser_de(fory, {"1": {1: 2}}) == {"1": {1: 2}}
105 assert ser_de(fory, {"k1": {"a": 2.0}, "k2": {-1.0: -1.0}}) == {
106 "k1": {"a": 2.0},
107 "k2": {-1.0: -1.0},
108 }
109 # make multiple references point to same `-1.0`.
110 dict3 = {
111 1: {5: -1.0},
112 2: {-1.0: -1.0, 10: -1.0},
113 }
114 assert ser_de(fory, dict3) == dict3
115
116
117@pytest.mark.parametrize("track_ref", [False, True])

Callers

nothing calls this directly

Calls 2

ForyClass · 0.90
ser_deFunction · 0.70

Tested by

no test coverage detected