|
10 | 10 | from typing import TypeVar, AnyStr
|
11 | 11 | from typing import T, KT, VT # Not in __all__.
|
12 | 12 | from typing import Union, Optional, Literal
|
13 |
| -from typing import Tuple, List, MutableMapping |
| 13 | +from typing import Tuple, List, Dict, MutableMapping |
14 | 14 | from typing import Callable
|
15 | 15 | from typing import Generic, ClassVar, Final, final, Protocol
|
16 | 16 | from typing import cast, runtime_checkable
|
@@ -3173,6 +3173,17 @@ def test_frozenset(self):
|
3173 | 3173 | def test_dict(self):
|
3174 | 3174 | self.assertIsSubclass(dict, typing.Dict)
|
3175 | 3175 |
|
| 3176 | + def test_dict_subscribe(self): |
| 3177 | + K = TypeVar('K') |
| 3178 | + V = TypeVar('V') |
| 3179 | + self.assertEqual(Dict[K, V][str, int], Dict[str, int]) |
| 3180 | + self.assertEqual(Dict[K, int][str], Dict[str, int]) |
| 3181 | + self.assertEqual(Dict[str, V][int], Dict[str, int]) |
| 3182 | + self.assertEqual(Dict[K, List[V]][str, int], Dict[str, List[int]]) |
| 3183 | + self.assertEqual(Dict[K, List[int]][str], Dict[str, List[int]]) |
| 3184 | + self.assertEqual(Dict[K, list[V]][str, int], Dict[str, list[int]]) |
| 3185 | + self.assertEqual(Dict[K, list[int]][str], Dict[str, list[int]]) |
| 3186 | + |
3176 | 3187 | def test_no_list_instantiation(self):
|
3177 | 3188 | with self.assertRaises(TypeError):
|
3178 | 3189 | typing.List()
|
|
0 commit comments