Skip to content
Prev Previous commit
Next Next commit
Add failing test
  • Loading branch information
AlexWaygood committed Jun 9, 2024
commit 373b23cb14e84270293cf2065291b5529807d015
5 changes: 5 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4868,6 +4868,11 @@ def test_pep695_generic_with_future_annotations(self):
hints_for_B = get_type_hints(ann_module695.B)
self.assertEqual(hints_for_B, {"x": int, "y": str, "z": bytes})

hints_for_C = get_type_hints(ann_module695.C)
self.assertNotIn(int, hints_for_C.values())
self.assertNotIn(str, hints_for_C.values())
self.assertEqual(set(hints_for_C.values()), set(C.__type_params__))

hints_for_generic_function = get_type_hints(ann_module695.generic_function)
func_t_params = ann_module695.generic_function.__type_params__
self.assertEqual(
Expand Down
9 changes: 9 additions & 0 deletions Lib/test/typinganndata/ann_module695.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ class B[T, *Ts, **P]:
z: P


Eggs = int
Spam = str


class C[Eggs, **Spam]:
x: Eggs
y: Spam


def generic_function[T, *Ts, **P](
x: T, *y: *Ts, z: P.args, zz: P.kwargs
) -> None: ...