()
| 850 | |
| 851 | |
| 852 | def test_annotated_strict(): |
| 853 | @validate_call |
| 854 | def f1(x: Annotated[int, Strict()]): |
| 855 | return x |
| 856 | |
| 857 | @validate_call |
| 858 | def f2(x: 'Annotated[int, Strict()]'): |
| 859 | return x |
| 860 | |
| 861 | for f in (f1, f2): |
| 862 | assert f(1) == 1 |
| 863 | |
| 864 | with pytest.raises(ValidationError) as exc_info: |
| 865 | f('1') |
| 866 | |
| 867 | assert exc_info.value.errors(include_url=False) == [ |
| 868 | {'type': 'int_type', 'loc': (0,), 'msg': 'Input should be a valid integer', 'input': '1'} |
| 869 | ] |
| 870 | |
| 871 | |
| 872 | def test_annotated_use_of_alias(): |