Skip to content

Commit 7548cd1

Browse files
authored
Update Final imports in tests (#18654)
Replace most `typing_extensions.Final` and `typing_extensions.final` imports in tests with `typing.Final` and `typing.final`.
1 parent 24ecb27 commit 7548cd1

31 files changed

+97
-153
lines changed

mypyc/test-data/alwaysdefined.test

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ IfConditionalAndNonConditional1: [x]
166166
IfConditionalAndNonConditional2: []
167167

168168
[case testAlwaysDefinedExpressions]
169-
from typing import Dict, List, Set, Optional, cast
170-
from typing_extensions import Final
169+
from typing import Dict, Final, List, Set, Optional, cast
171170

172171
import other
173172

@@ -307,7 +306,7 @@ def f() -> int:
307306

308307
[file other.py]
309308
# Not compiled
310-
from typing_extensions import Final
309+
from typing import Final
311310

312311
Y: Final = 3
313312

mypyc/test-data/commandline.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def f(x: int) -> int:
105105
# cmd: test.py
106106

107107
[file test.py]
108-
from typing import List, Any, AsyncIterable
109-
from typing_extensions import Final
108+
from typing import Final, List, Any, AsyncIterable
110109
from mypy_extensions import trait, mypyc_attr
111110
from functools import singledispatch
112111

mypyc/test-data/exceptions-freq.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ L2:
9797
hot blocks: [0, 1]
9898

9999
[case testRareBranch_freq]
100-
from typing_extensions import Final
100+
from typing import Final
101101

102102
x: Final = str()
103103

mypyc/test-data/irbuild-constant-fold.test

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ L0:
187187
return 1
188188

189189
[case testIntConstantFoldingFinal]
190-
from typing_extensions import Final
190+
from typing import Final
191191
X: Final = 5
192192
Y: Final = 2 + 4
193193

@@ -203,7 +203,7 @@ L0:
203203
return 1
204204

205205
[case testIntConstantFoldingClassFinal]
206-
from typing_extensions import Final
206+
from typing import Final
207207
class C:
208208
X: Final = 5
209209

@@ -222,7 +222,7 @@ L0:
222222
return 1
223223

224224
[case testFloatConstantFolding]
225-
from typing_extensions import Final
225+
from typing import Final
226226

227227
N: Final = 1.5
228228
N2: Final = 1.5 * 2
@@ -391,7 +391,7 @@ L2:
391391
return 1
392392

393393
[case testStrConstantFolding]
394-
from typing_extensions import Final
394+
from typing import Final
395395

396396
S: Final = 'z'
397397
N: Final = 2
@@ -416,7 +416,7 @@ L0:
416416
return 1
417417

418418
[case testBytesConstantFolding]
419-
from typing_extensions import Final
419+
from typing import Final
420420

421421
N: Final = 2
422422

@@ -438,7 +438,7 @@ L0:
438438
return 1
439439

440440
[case testComplexConstantFolding]
441-
from typing_extensions import Final
441+
from typing import Final
442442

443443
N: Final = 1
444444
FLOAT_N: Final = 1.5

mypyc/test-data/irbuild-float.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ L0:
219219
return r0
220220

221221
[case testFloatFinalConstant]
222-
from typing_extensions import Final
222+
from typing import Final
223223

224224
X: Final = 123.0
225225
Y: Final = -1.0

mypyc/test-data/irbuild-i64.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ L2:
16771677
return 1
16781678

16791679
[case testI64FinalConstants]
1680-
from typing_extensions import Final
1680+
from typing import Final
16811681
from mypy_extensions import i64
16821682

16831683
A: Final = -1

mypyc/test-data/irbuild-int.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ L0:
116116
return r0
117117

118118
[case testFinalConstantFolding]
119-
from typing_extensions import Final
119+
from typing import Final
120120

121121
X: Final = -1
122122
Y: Final = -(1 + 3*2)

mypyc/test-data/irbuild-set.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ L0:
628628
return r0
629629

630630
[case testOperatorInSetLiteral]
631-
from typing_extensions import Final
631+
from typing import Final
632632

633633
CONST: Final = "daylily"
634634
non_const = 10
@@ -716,7 +716,7 @@ L0:
716716
return r14
717717

718718
[case testForSetLiteral]
719-
from typing_extensions import Final
719+
from typing import Final
720720

721721
CONST: Final = 10
722722
non_const = 20

mypyc/test-data/refcount.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ L0:
13391339
return r2
13401340

13411341
[case testBorrowIntCompareFinal]
1342-
from typing_extensions import Final
1342+
from typing import Final
13431343

13441344
X: Final = 10
13451345

mypyc/test-data/run-classes.test

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,7 @@ Traceback (most recent call last):
711711
AttributeError: attribute 'x' of 'X' undefined
712712

713713
[case testClassMethods]
714-
from typing import ClassVar, Any
715-
from typing_extensions import final
714+
from typing import ClassVar, Any, final
716715
from mypy_extensions import mypyc_attr
717716

718717
from interp import make_interpreted_subclass
@@ -2543,7 +2542,7 @@ class Derived(Base):
25432542
assert Derived()() == 1
25442543

25452544
[case testClassWithFinalAttribute]
2546-
from typing_extensions import Final
2545+
from typing import Final
25472546

25482547
class C:
25492548
A: Final = -1

0 commit comments

Comments
 (0)