| 341 | ], |
| 342 | ) |
| 343 | def test_int_constr_bounds(self, name, bound, good, bad): |
| 344 | class Ex(Struct): |
| 345 | x: Annotated[int, Meta(**{name: bound})] |
| 346 | |
| 347 | for x in good: |
| 348 | assert convert({"x": x}, Ex).x == x |
| 349 | |
| 350 | op = ">=" if name.startswith("g") else "<=" |
| 351 | offset = {"lt": -1, "gt": 1}.get(name, 0) |
| 352 | err_msg = rf"Expected `int` {op} {bound + offset} - at `\$.x`" |
| 353 | for x in bad: |
| 354 | with pytest.raises(ValidationError, match=err_msg): |
| 355 | convert({"x": x}, Ex) |
| 356 | |
| 357 | def test_int_constr_multiple_of(self): |
| 358 | class Ex(Struct): |