(self, proto, name, bound)
| 386 | @pytest.mark.parametrize("name", ["ge", "gt", "le", "lt"]) |
| 387 | @pytest.mark.parametrize("bound", [1.5, -1.5, 10.0]) |
| 388 | def test_bounds(self, proto, name, bound): |
| 389 | class Ex(msgspec.Struct): |
| 390 | x: Annotated[float, Meta(**{name: bound})] |
| 391 | |
| 392 | dec = proto.Decoder(Ex) |
| 393 | |
| 394 | good, bad, op = self.get_bounds_cases(name, bound) |
| 395 | |
| 396 | for x in good: |
| 397 | assert dec.decode(proto.encode(Ex(x))).x == x |
| 398 | |
| 399 | err_msg = rf"Expected `float` {op} {bound} - at `\$.x`" |
| 400 | for x in bad: |
| 401 | with pytest.raises(msgspec.ValidationError, match=err_msg): |
| 402 | dec.decode(proto.encode(Ex(x))) |
| 403 | |
| 404 | def test_multiple_of(self, proto): |
| 405 | """multipleOf for floats will always have precisions issues. This check |
nothing calls this directly
no test coverage detected