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 4bed9c4 commit 81fb354Copy full SHA for 81fb354
Lib/test/test_typing.py
@@ -6024,6 +6024,19 @@ def test_get_type_hints(self):
6024
{'a': typing.Optional[int], 'b': int}
6025
)
6026
6027
+ def test_non_generic_subscript(self):
6028
+ # For backward compatibility, subscription works
6029
+ # on arbitrary TypedDict types.
6030
+ class TD(TypedDict):
6031
+ a: T
6032
+ A = TD[int]
6033
+ self.assertEqual(A.__origin__, TD)
6034
+ self.assertEqual(A.__parameters__, ())
6035
+ self.assertEqual(A.__args__, (int,))
6036
+ a = A(a = 1)
6037
+ self.assertIs(type(a), dict)
6038
+ self.assertEqual(a, {'a': 1})
6039
+
6040
6041
class RequiredTests(BaseTestCase):
6042
0 commit comments