Skip to content

Commit 9f0f393

Browse files
committed
Why have nice things when we can not have them?
1 parent f728f0b commit 9f0f393

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tests/v/test_fluent.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Tests for the fluent validation API."""
2+
from typing import Dict, List, Union
3+
24
from attrs import Factory, define, evolve
35
from attrs import fields as f
46
from pytest import fixture, raises
@@ -13,7 +15,7 @@ def c() -> Converter:
1315
res = Converter()
1416

1517
res.register_structure_hook(
16-
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)
1719
)
1820

1921
return res
@@ -25,12 +27,12 @@ class Model:
2527

2628
a: int
2729
b: str
28-
c: list[str] = Factory(list)
29-
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)
30+
c: List[str] = Factory(list)
31+
d: List[int] = Factory(list)
32+
e: Union[str, None] = None
33+
f: Union[int, None] = None
34+
g: Union[str, int] = 0
35+
h: Dict[str, int] = Factory(dict)
3436

3537

3638
def is_lowercase(val: str) -> None:

0 commit comments

Comments
 (0)