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 5f40cb8 commit adc06cdCopy full SHA for adc06cd
Lib/test/test_typing.py
@@ -4485,6 +4485,19 @@ def test_get_type_hints(self):
4485
{'a': typing.Optional[int], 'b': int}
4486
)
4487
4488
+ def test_non_generic_subscript(self):
4489
+ # For backward compatibility, subscription works
4490
+ # on arbitrary TypedDict types.
4491
+ class TD(TypedDict):
4492
+ a: T
4493
+ A = TD[int]
4494
+ self.assertEqual(A.__origin__, TD)
4495
+ self.assertEqual(A.__parameters__, ())
4496
+ self.assertEqual(A.__args__, (int,))
4497
+ a = A(a = 1)
4498
+ self.assertIs(type(a), dict)
4499
+ self.assertEqual(a, {'a': 1})
4500
+
4501
4502
class IOTests(BaseTestCase):
4503
0 commit comments