|
4 | 4 | """ |
5 | 5 |
|
6 | 6 | import inspect |
7 | | -from typing import Any, Generator, Iterator, Iterable, List, Optional, Union, Sequence |
| 7 | +from typing import Any, Generator, Iterable, Iterator, List, Optional, Sequence, Union |
8 | 8 |
|
9 | 9 | import pytest |
10 | | -from hypothesis import given, strategies as st, settings |
| 10 | +from hypothesis import given, settings |
| 11 | +from hypothesis import strategies as st |
11 | 12 | from pydantic import Field |
12 | 13 | from pydantic.fields import FieldInfo |
13 | 14 |
|
14 | 15 | from confection._registry import ( |
15 | | - process_param_annotation, |
16 | | - process_param_default, |
17 | | - get_param_field, |
18 | | - _reorder_union_for_generators, |
| 16 | + ARGS_FIELD_ALIAS, |
19 | 17 | _is_iterable_type, |
20 | 18 | _is_sequence_type, |
21 | | - ARGS_FIELD_ALIAS, |
| 19 | + _reorder_union_for_generators, |
| 20 | + get_param_field, |
| 21 | + process_param_annotation, |
| 22 | + process_param_default, |
22 | 23 | ) |
23 | 24 |
|
24 | | - |
25 | 25 | # ============================================================================= |
26 | 26 | # Strategies for type annotations |
27 | 27 | # ============================================================================= |
@@ -92,7 +92,7 @@ def test_list_types_unchanged(self, annotation): |
92 | 92 |
|
93 | 93 | def test_union_with_generator_wrapped(self): |
94 | 94 | """Union with Generator should be wrapped with generator-safe validator.""" |
95 | | - from typing import get_origin, get_args, Annotated |
| 95 | + from typing import Annotated, get_args, get_origin |
96 | 96 |
|
97 | 97 | annotation = Union[float, List[float], Generator] |
98 | 98 | result = process_param_annotation(annotation) |
@@ -338,7 +338,7 @@ def test_var_positional_wraps_in_sequence(name, annotation): |
338 | 338 | @settings(max_examples=100) |
339 | 339 | def test_union_with_generators_wrapped(annotation): |
340 | 340 | """Property test: Unions containing generators should be wrapped in Annotated.""" |
341 | | - from typing import get_origin, get_args, Annotated |
| 341 | + from typing import Annotated, get_args, get_origin |
342 | 342 |
|
343 | 343 | result = process_param_annotation(annotation) |
344 | 344 |
|
|
0 commit comments