@@ -81,7 +81,7 @@ def test_structure_generics_with_cols(t, result, detailed_validation):
81
81
@pytest .mark .parametrize (
82
82
("t" , "result" ), ((int , (1 , [2 ], {"3" : 3 })), (str , ("1" , ["2" ], {"3" : "3" })))
83
83
)
84
- def test_39_structure_generics_with_cols (t , result ):
84
+ def test_39_structure_generics_with_cols (t , result , genconverter : Converter ):
85
85
@define
86
86
class GenericCols (Generic [T ]):
87
87
a : T
@@ -90,21 +90,21 @@ class GenericCols(Generic[T]):
90
90
91
91
expected = GenericCols (* result )
92
92
93
- res = Converter () .structure (asdict (expected ), GenericCols [t ])
93
+ res = genconverter .structure (asdict (expected ), GenericCols [t ])
94
94
95
95
assert res == expected
96
96
97
97
98
98
@pytest .mark .parametrize (("t" , "result" ), ((int , (1 , [1 , 2 , 3 ])), (int , (1 , None ))))
99
- def test_structure_nested_generics_with_cols (t , result ):
99
+ def test_structure_nested_generics_with_cols (t , result , genconverter : Converter ):
100
100
@define
101
101
class GenericCols (Generic [T ]):
102
102
a : T
103
103
b : Optional [List [T ]]
104
104
105
105
expected = GenericCols (* result )
106
106
107
- res = Converter () .structure (asdict (expected ), GenericCols [t ])
107
+ res = genconverter .structure (asdict (expected ), GenericCols [t ])
108
108
109
109
assert res == expected
110
110
@@ -296,6 +296,7 @@ def test_generate_typeddict_mapping() -> None:
296
296
from typing import Generic , TypedDict , TypeVar
297
297
298
298
T = TypeVar ("T" )
299
+ U = TypeVar ("U" )
299
300
300
301
class A (TypedDict ):
301
302
pass
@@ -312,6 +313,12 @@ class B(A[int]):
312
313
313
314
assert generate_mapping (B , {}) == {T .__name__ : int }
314
315
316
+ class C (Generic [T , U ]):
317
+ a : T
318
+ c : U
319
+
320
+ assert generate_mapping (C [int , U ], {}) == {T .__name__ : int }
321
+
315
322
316
323
def test_nongeneric_protocols (converter ):
317
324
"""Non-generic protocols work."""
0 commit comments