We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f728f0b commit 9f0f393Copy full SHA for 9f0f393
tests/v/test_fluent.py
@@ -1,4 +1,6 @@
1
"""Tests for the fluent validation API."""
2
+from typing import Dict, List, Union
3
+
4
from attrs import Factory, define, evolve
5
from attrs import fields as f
6
from pytest import fixture, raises
@@ -13,7 +15,7 @@ def c() -> Converter:
13
15
res = Converter()
14
16
17
res.register_structure_hook(
- str | int, lambda v, t: v if isinstance(v, int) else str(v)
18
+ Union[str, int], lambda v, _: v if isinstance(v, int) else str(v)
19
)
20
21
return res
@@ -25,12 +27,12 @@ class Model:
25
27
26
28
a: int
29
b: str
- c: list[str] = Factory(list)
- d: list[int] = Factory(list)
30
- e: str | None = None
31
- f: int | None = None
32
- g: str | int = 0
33
- h: dict[str, int] = Factory(dict)
+ c: List[str] = Factory(list)
+ d: List[int] = Factory(list)
+ e: Union[str, None] = None
+ f: Union[int, None] = None
34
+ g: Union[str, int] = 0
35
+ h: Dict[str, int] = Factory(dict)
36
37
38
def is_lowercase(val: str) -> None:
0 commit comments