@@ -5184,11 +5184,12 @@ def test() -> None:
5184
5184
[builtins fixtures/tuple.pyi]
5185
5185
5186
5186
[case testCrashOnSelfRecursiveTypedDictVar]
5187
- from mypy_extensions import TypedDict
5187
+ from typing import TypedDict
5188
5188
5189
5189
A = TypedDict('A', {'a': 'A'}) # type: ignore
5190
5190
a: A
5191
5191
[builtins fixtures/isinstancelist.pyi]
5192
+ [typing fixtures/typing-typeddict.pyi]
5192
5193
5193
5194
[case testCrashInJoinOfSelfRecursiveNamedTuples]
5194
5195
@@ -5205,7 +5206,7 @@ lst = [n, m]
5205
5206
[builtins fixtures/isinstancelist.pyi]
5206
5207
5207
5208
[case testCorrectJoinOfSelfRecursiveTypedDicts]
5208
- from mypy_extensions import TypedDict
5209
+ from typing import TypedDict
5209
5210
5210
5211
def test() -> None:
5211
5212
class N(TypedDict):
@@ -5220,6 +5221,7 @@ def test() -> None:
5220
5221
lst = [n, m]
5221
5222
reveal_type(lst[0]['x']) # N: Revealed type is "Any"
5222
5223
[builtins fixtures/isinstancelist.pyi]
5224
+ [typing fixtures/typing-typeddict.pyi]
5223
5225
5224
5226
[case testCrashInForwardRefToNamedTupleWithIsinstance]
5225
5227
from typing import Dict, NamedTuple
@@ -5236,8 +5238,7 @@ def parse_ast(name_dict: NameDict) -> None:
5236
5238
[typing fixtures/typing-medium.pyi]
5237
5239
5238
5240
[case testCrashInForwardRefToTypedDictWithIsinstance]
5239
- from mypy_extensions import TypedDict
5240
- from typing import Dict
5241
+ from typing import Dict, TypedDict
5241
5242
5242
5243
NameDict = Dict[str, 'NameInfo']
5243
5244
class NameInfo(TypedDict):
@@ -5248,7 +5249,7 @@ def parse_ast(name_dict: NameDict) -> None:
5248
5249
pass
5249
5250
reveal_type(name_dict['']['ast']) # N: Revealed type is "builtins.bool"
5250
5251
[builtins fixtures/isinstancelist.pyi]
5251
- [typing fixtures/typing-medium .pyi]
5252
+ [typing fixtures/typing-typeddict .pyi]
5252
5253
5253
5254
[case testCorrectIsinstanceInForwardRefToNewType]
5254
5255
from typing import Dict, NewType
@@ -5313,13 +5314,13 @@ x = NT(N(1))
5313
5314
5314
5315
[case testNewTypeFromForwardTypedDict]
5315
5316
5316
- from typing import NewType, Tuple
5317
- from mypy_extensions import TypedDict
5317
+ from typing import NewType, Tuple, TypedDict
5318
5318
5319
5319
NT = NewType('NT', 'N') # E: Argument 2 to NewType(...) must be subclassable (got "N")
5320
5320
class N(TypedDict):
5321
5321
x: int
5322
5322
[builtins fixtures/dict.pyi]
5323
+ [typing fixtures/typing-typeddict.pyi]
5323
5324
[out]
5324
5325
5325
5326
[case testCorrectAttributeInForwardRefToNamedTuple]
@@ -5335,7 +5336,7 @@ class Process(NamedTuple):
5335
5336
[out]
5336
5337
5337
5338
[case testCorrectItemTypeInForwardRefToTypedDict]
5338
- from mypy_extensions import TypedDict
5339
+ from typing import TypedDict
5339
5340
proc: Process
5340
5341
reveal_type(proc['state']) # N: Revealed type is "builtins.int"
5341
5342
@@ -5344,6 +5345,7 @@ def get_state(proc: 'Process') -> int:
5344
5345
class Process(TypedDict):
5345
5346
state: int
5346
5347
[builtins fixtures/isinstancelist.pyi]
5348
+ [typing fixtures/typing-typeddict.pyi]
5347
5349
[out]
5348
5350
5349
5351
[case testCorrectDoubleForwardNamedTuple]
@@ -5362,7 +5364,7 @@ reveal_type(x.one.attr) # N: Revealed type is "builtins.str"
5362
5364
[out]
5363
5365
5364
5366
[case testCrashOnDoubleForwardTypedDict]
5365
- from mypy_extensions import TypedDict
5367
+ from typing import TypedDict
5366
5368
5367
5369
x: A
5368
5370
class A(TypedDict):
@@ -5373,6 +5375,7 @@ class B(TypedDict):
5373
5375
5374
5376
reveal_type(x['one']['attr']) # N: Revealed type is "builtins.str"
5375
5377
[builtins fixtures/isinstancelist.pyi]
5378
+ [typing fixtures/typing-typeddict.pyi]
5376
5379
[out]
5377
5380
5378
5381
[case testCrashOnForwardUnionOfNamedTuples]
@@ -5392,8 +5395,7 @@ def foo(node: Node) -> int:
5392
5395
[out]
5393
5396
5394
5397
[case testCrashOnForwardUnionOfTypedDicts]
5395
- from mypy_extensions import TypedDict
5396
- from typing import Union
5398
+ from typing import TypedDict, Union
5397
5399
5398
5400
NodeType = Union['Foo', 'Bar']
5399
5401
class Foo(TypedDict):
@@ -5405,6 +5407,7 @@ def foo(node: NodeType) -> int:
5405
5407
x = node
5406
5408
return x['x']
5407
5409
[builtins fixtures/isinstancelist.pyi]
5410
+ [typing fixtures/typing-typeddict.pyi]
5408
5411
[out]
5409
5412
5410
5413
[case testSupportForwardUnionOfNewTypes]
@@ -5471,8 +5474,7 @@ def f(x: ForwardUnion) -> None:
5471
5474
[out]
5472
5475
5473
5476
[case testCrashInvalidArgsSyntheticClassSyntax]
5474
- from typing import List, NamedTuple
5475
- from mypy_extensions import TypedDict
5477
+ from typing import List, NamedTuple, TypedDict
5476
5478
class TD(TypedDict):
5477
5479
x: List[int, str] # E: "list" expects 1 type argument, but 2 given
5478
5480
class NM(NamedTuple):
@@ -5482,11 +5484,11 @@ class NM(NamedTuple):
5482
5484
TD({'x': []})
5483
5485
NM(x=[])
5484
5486
[builtins fixtures/dict.pyi]
5487
+ [typing fixtures/typing-typeddict.pyi]
5485
5488
[out]
5486
5489
5487
5490
[case testCrashInvalidArgsSyntheticClassSyntaxReveals]
5488
- from typing import List, NamedTuple
5489
- from mypy_extensions import TypedDict
5491
+ from typing import List, NamedTuple, TypedDict
5490
5492
class TD(TypedDict):
5491
5493
x: List[int, str] # E: "list" expects 1 type argument, but 2 given
5492
5494
class NM(NamedTuple):
@@ -5501,11 +5503,11 @@ reveal_type(x1) # N: Revealed type is "TypedDict('__main__.TD', {'x': builtins.l
5501
5503
reveal_type(y) # N: Revealed type is "Tuple[builtins.list[Any], fallback=__main__.NM]"
5502
5504
reveal_type(y1) # N: Revealed type is "Tuple[builtins.list[Any], fallback=__main__.NM]"
5503
5505
[builtins fixtures/dict.pyi]
5506
+ [typing fixtures/typing-typeddict.pyi]
5504
5507
[out]
5505
5508
5506
5509
[case testCrashInvalidArgsSyntheticFunctionSyntax]
5507
- from typing import List, NewType, NamedTuple
5508
- from mypy_extensions import TypedDict
5510
+ from typing import List, NewType, NamedTuple, TypedDict
5509
5511
TD = TypedDict('TD', {'x': List[int, str]}) # E: "list" expects 1 type argument, but 2 given
5510
5512
NM = NamedTuple('NM', [('x', List[int, str])]) # E: "list" expects 1 type argument, but 2 given
5511
5513
NT = NewType('NT', List[int, str]) # E: "list" expects 1 type argument, but 2 given
@@ -5515,11 +5517,11 @@ TD({'x': []})
5515
5517
NM(x=[])
5516
5518
NT([])
5517
5519
[builtins fixtures/dict.pyi]
5520
+ [typing fixtures/typing-typeddict.pyi]
5518
5521
[out]
5519
5522
5520
5523
[case testCrashForwardSyntheticClassSyntax]
5521
- from typing import NamedTuple
5522
- from mypy_extensions import TypedDict
5524
+ from typing import NamedTuple, TypedDict
5523
5525
class A1(NamedTuple):
5524
5526
b: 'B'
5525
5527
x: int
@@ -5533,11 +5535,11 @@ y: A2
5533
5535
reveal_type(x.b) # N: Revealed type is "__main__.B"
5534
5536
reveal_type(y['b']) # N: Revealed type is "__main__.B"
5535
5537
[builtins fixtures/dict.pyi]
5538
+ [typing fixtures/typing-typeddict.pyi]
5536
5539
[out]
5537
5540
5538
5541
[case testCrashForwardSyntheticFunctionSyntax]
5539
- from typing import NamedTuple
5540
- from mypy_extensions import TypedDict
5542
+ from typing import NamedTuple, TypedDict
5541
5543
A1 = NamedTuple('A1', [('b', 'B'), ('x', int)])
5542
5544
A2 = TypedDict('A2', {'b': 'B', 'x': int})
5543
5545
class B:
@@ -5547,6 +5549,7 @@ y: A2
5547
5549
reveal_type(x.b) # N: Revealed type is "__main__.B"
5548
5550
reveal_type(y['b']) # N: Revealed type is "__main__.B"
5549
5551
[builtins fixtures/dict.pyi]
5552
+ [typing fixtures/typing-typeddict.pyi]
5550
5553
[out]
5551
5554
5552
5555
-- Special support for six
0 commit comments