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

Method test_combinations

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

Source from the content-addressed store, hash-verified

430 ],
431 )
432 def test_combinations(self, proto, meta, good, bad):
433 class Ex(msgspec.Struct):
434 x: Annotated[float, meta]
435
436 dec = proto.Decoder(Ex)
437
438 for x in good:
439 assert dec.decode(proto.encode(Ex(x))).x == x
440
441 for x in bad:
442 with pytest.raises(msgspec.ValidationError):
443 assert dec.decode(proto.encode(Ex(x)))
444
445
446class TestStrConstraints:

Callers

nothing calls this directly

Calls 2

decodeMethod · 0.80
ExClass · 0.70

Tested by

no test coverage detected