MCPcopy Index your code
hub / github.com/msgspec/msgspec / test_combinations

Method test_combinations

tests/unit/test_constraints.py:335–346  ·  view source on GitHub ↗
(self, proto, meta, good, bad)

Source from the content-addressed store, hash-verified

333 ],
334 )
335 def test_combinations(self, proto, meta, good, bad):
336 class Ex(msgspec.Struct):
337 x: Annotated[int, meta]
338
339 dec = proto.Decoder(Ex)
340
341 for x in good:
342 assert dec.decode(proto.encode(Ex(x))).x == x
343
344 for x in bad:
345 with pytest.raises(msgspec.ValidationError):
346 dec.decode(proto.encode(Ex(x)))
347
348
349class TestFloatConstraints:

Callers

nothing calls this directly

Calls 2

decodeMethod · 0.80
ExClass · 0.70

Tested by

no test coverage detected