(decorator1)
| 2845 | |
| 2846 | @pytest.mark.parametrize('decorator1', **dataclass_decorators()) |
| 2847 | def test_annotated_before_validator_called_once(decorator1): |
| 2848 | count = 0 |
| 2849 | |
| 2850 | def convert(value: int) -> str: |
| 2851 | nonlocal count |
| 2852 | count += 1 |
| 2853 | return str(value) |
| 2854 | |
| 2855 | IntToStr = Annotated[str, BeforeValidator(convert)] |
| 2856 | |
| 2857 | @decorator1 |
| 2858 | class A: |
| 2859 | a: IntToStr |
| 2860 | |
| 2861 | assert count == 0 |
| 2862 | TypeAdapter(A).validate_python({'a': 123}) |
| 2863 | assert count == 1 |
| 2864 | |
| 2865 | |
| 2866 | def test_is_pydantic_dataclass(): |
nothing calls this directly
no test coverage detected