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 51b885a commit 7e55730Copy full SHA for 7e55730
Lib/test/test_typing.py
@@ -4076,6 +4076,19 @@ def test_get_type_hints(self):
4076
{'a': typing.Optional[int], 'b': int}
4077
)
4078
4079
+ def test_non_generic_subscript(self):
4080
+ # For backward compatibility, subscription works
4081
+ # on arbitrary TypedDict types.
4082
+ class TD(TypedDict):
4083
+ a: T
4084
+ A = TD[int]
4085
+ self.assertEqual(A.__origin__, TD)
4086
+ self.assertEqual(A.__parameters__, ())
4087
+ self.assertEqual(A.__args__, (int,))
4088
+ a = A(a = 1)
4089
+ self.assertIs(type(a), dict)
4090
+ self.assertEqual(a, {'a': 1})
4091
+
4092
4093
class IOTests(BaseTestCase):
4094
0 commit comments