MCPcopy
hub / github.com/msgspec/msgspec / test_dict_cyclic_recursion

Method test_dict_cyclic_recursion

tests/unit/test_convert.py:1223–1240  ·  view source on GitHub ↗
(self, dictcls)

Source from the content-addressed store, hash-verified

1221 reason="CPython 3.12 internal changes prevent testing for recursion issues this way",
1222 )
1223 def test_dict_cyclic_recursion(self, dictcls):
1224 depth = 50
1225 typ = Dict[str, int]
1226 for _ in range(depth):
1227 typ = Dict[str, typ]
1228
1229 class Cache(Struct):
1230 value: typ
1231
1232 msgspec.json.Decoder(Cache)
1233
1234 map = dictcls()
1235 map["x"] = map
1236 msg = {"value": map}
1237
1238 with pytest.raises(RecursionError):
1239 with max_call_depth(5):
1240 convert(msg, Cache)
1241
1242 def test_dict_constrs(self, dictcls):
1243 class Ex(Struct):

Callers

nothing calls this directly

Calls 2

dictclsFunction · 0.85
max_call_depthFunction · 0.85

Tested by

no test coverage detected