Skip to content

Commit 958c4ba

Browse files
authored
Cleanup some more tests after dropping 3.9 support (#21256)
Followup to #21243 Remove unnecessary `--python-version 3.10` flags now that 3.10 is the default.
1 parent f551cb4 commit 958c4ba

17 files changed

+28
-88
lines changed

mypyc/test-data/run-misc.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -986,9 +986,6 @@ elif sys.version_info[:2] == (3, 11):
986986
elif sys.version_info[:2] == (3, 10):
987987
def version() -> int:
988988
return 10
989-
elif sys.version_info[:2] == (3, 9):
990-
def version() -> int:
991-
return 9
992989
else:
993990
raise Exception("we don't support this version yet!")
994991

test-data/unit/check-dataclasses.test

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ class Application:
378378
[builtins fixtures/dataclasses.pyi]
379379

380380
[case testDataclassesOrderingKwOnly]
381-
# flags: --python-version 3.10
382381
from dataclasses import dataclass
383382

384383
@dataclass(kw_only=True)
@@ -398,7 +397,6 @@ Application(rating='name', name=123) # E: Argument "rating" to "Application" has
398397
[builtins fixtures/dataclasses.pyi]
399398

400399
[case testDataclassesOrderingKwOnlyOnField]
401-
# flags: --python-version 3.10
402400
from dataclasses import dataclass, field
403401

404402
@dataclass
@@ -417,7 +415,6 @@ Application(123, rating='name') # E: Argument 1 to "Application" has incompatibl
417415
[builtins fixtures/dataclasses.pyi]
418416

419417
[case testDataclassesOrderingKwOnlyOnFieldFalse]
420-
# flags: --python-version 3.10
421418
from dataclasses import dataclass, field
422419

423420
@dataclass
@@ -434,7 +431,6 @@ Application('name') # E: Too few arguments for "Application"
434431
[builtins fixtures/dataclasses.pyi]
435432

436433
[case testDataclassesOrderingKwOnlyWithSentinel]
437-
# flags: --python-version 3.10
438434
from dataclasses import dataclass, KW_ONLY
439435

440436
@dataclass
@@ -453,7 +449,6 @@ Application('name', rating=123) # E: Too many positional arguments for "Applica
453449
[builtins fixtures/dataclasses.pyi]
454450

455451
[case testDataclassesOrderingKwOnlyWithSentinelAndFieldOverride]
456-
# flags: --python-version 3.10
457452
from dataclasses import dataclass, field, KW_ONLY
458453

459454
@dataclass
@@ -473,7 +468,6 @@ Application(123, rating=123) # E: "Application" gets multiple values for keywor
473468
[builtins fixtures/dataclasses.pyi]
474469

475470
[case testDataclassesOrderingKwOnlyWithSentinelAndSubclass]
476-
# flags: --python-version 3.10
477471
from dataclasses import dataclass, field, KW_ONLY
478472

479473
@dataclass
@@ -500,7 +494,6 @@ D(123, False) # E: Argument 1 to "D" has incompatible type "int"; expected "str
500494
[builtins fixtures/dataclasses.pyi]
501495

502496
[case testDataclassesOrderingKwOnlyWithMultipleSentinel]
503-
# flags: --python-version 3.10
504497
from dataclasses import dataclass, field, KW_ONLY
505498

506499
@dataclass
@@ -1427,7 +1420,6 @@ reveal_type(Foo(bar=1.5)) # N: Revealed type is "__main__.Foo"
14271420
[typing fixtures/typing-typeddict.pyi]
14281421

14291422
[case testDataclassWithSlotsArg]
1430-
# flags: --python-version 3.10
14311423
from dataclasses import dataclass
14321424

14331425
@dataclass(slots=True)
@@ -1443,7 +1435,6 @@ class Some:
14431435
[builtins fixtures/dataclasses.pyi]
14441436

14451437
[case testDataclassWithSlotsDef]
1446-
# flags: --python-version 3.10
14471438
from dataclasses import dataclass
14481439

14491440
@dataclass(slots=False)
@@ -1460,7 +1451,6 @@ class Some:
14601451
[builtins fixtures/dataclasses.pyi]
14611452

14621453
[case testDataclassWithSlotsDerivedFromNonSlot]
1463-
# flags: --python-version 3.10
14641454
from dataclasses import dataclass
14651455

14661456
class A:
@@ -1476,7 +1466,6 @@ class B(A):
14761466
[builtins fixtures/dataclasses.pyi]
14771467

14781468
[case testDataclassWithSlotsConflict]
1479-
# flags: --python-version 3.10
14801469
from dataclasses import dataclass
14811470

14821471
@dataclass(slots=True)
@@ -1498,7 +1487,6 @@ class DynamicDef: # E: "DynamicDef" both defines "__slots__" and is used with "
14981487
[builtins fixtures/dataclasses.pyi]
14991488

15001489
[case testDataclassWithSlotsRuntimeAttr]
1501-
# flags: --python-version 3.10
15021490
from dataclasses import dataclass
15031491

15041492
@dataclass(slots=True)
@@ -1527,7 +1515,6 @@ NoSlots.__slots__ # E: "type[NoSlots]" has no attribute "__slots__"
15271515

15281516

15291517
[case testSlotsDefinitionWithTwoPasses1]
1530-
# flags: --python-version 3.10
15311518
# https://github.com/python/mypy/issues/11821
15321519
from typing import TypeVar, Protocol, Generic
15331520
from dataclasses import dataclass
@@ -1545,7 +1532,6 @@ class Node(Generic[V]): # Error was here
15451532
[builtins fixtures/dataclasses.pyi]
15461533

15471534
[case testSlotsDefinitionWithTwoPasses2]
1548-
# flags: --python-version 3.10
15491535
from typing import TypeVar, Protocol, Generic
15501536
from dataclasses import dataclass
15511537

@@ -1563,7 +1549,6 @@ class Node(Generic[V]): # E: "Node" both defines "__slots__" and is used with "
15631549
[builtins fixtures/dataclasses.pyi]
15641550

15651551
[case testSlotsDefinitionWithTwoPasses3]
1566-
# flags: --python-version 3.10
15671552
from typing import TypeVar, Protocol, Generic
15681553
from dataclasses import dataclass
15691554

@@ -1581,7 +1566,6 @@ class Node(Generic[V]): # E: "Node" both defines "__slots__" and is used with "
15811566
[builtins fixtures/dataclasses.pyi]
15821567

15831568
[case testSlotsDefinitionWithTwoPasses4]
1584-
# flags: --python-version 3.10
15851569
import dataclasses as dtc
15861570

15871571
PublishedMessagesVar = dict[int, 'PublishedMessages']
@@ -1592,7 +1576,6 @@ class PublishedMessages:
15921576
[builtins fixtures/dataclasses.pyi]
15931577

15941578
[case testDataclassSlotsWithDeferredBase]
1595-
# flags: --python-version 3.10
15961579
from dataclasses import dataclass
15971580

15981581
@dataclass
@@ -1653,7 +1636,6 @@ def foo() -> None:
16531636
[builtins fixtures/dataclasses.pyi]
16541637

16551638
[case testDataclassesMultipleInheritanceWithNonDataclass]
1656-
# flags: --python-version 3.10
16571639
from dataclasses import dataclass
16581640

16591641
@dataclass
@@ -1828,7 +1810,6 @@ class MyClass(MyGeneric[MyDataclass]): ...
18281810
[builtins fixtures/dataclasses.pyi]
18291811

18301812
[case testDataclassWithMatchArgs]
1831-
# flags: --python-version 3.10
18321813
from dataclasses import dataclass
18331814
@dataclass
18341815
class One:
@@ -1849,7 +1830,6 @@ reveal_type(e.__match_args__) # N: Revealed type is "tuple[()]"
18491830
[builtins fixtures/dataclasses.pyi]
18501831

18511832
[case testDataclassWithMatchArgsAndKwOnly]
1852-
# flags: --python-version 3.10
18531833
from dataclasses import dataclass, field
18541834
@dataclass(kw_only=True)
18551835
class One:
@@ -1865,7 +1845,6 @@ reveal_type(Two.__match_args__) # N: Revealed type is "tuple[Literal['a']]"
18651845
[builtins fixtures/dataclasses.pyi]
18661846

18671847
[case testDataclassWithoutMatchArgs]
1868-
# flags: --python-version 3.10
18691848
from dataclasses import dataclass
18701849
@dataclass(match_args=False)
18711850
class One:

test-data/unit/check-generic-alias.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ t23: collections.abc.ValuesView[str]
150150
[builtins fixtures/tuple.pyi]
151151

152152
[case testGenericAliasIsinstanceUnreachable]
153-
# flags: --warn-unreachable --python-version 3.10
153+
# flags: --warn-unreachable
154154
from collections.abc import Iterable
155155

156156
class A: ...
@@ -165,7 +165,7 @@ def test(dependencies: list[A] | None) -> None:
165165
[typing fixtures/typing-full.pyi]
166166

167167
[case testGenericAliasRedundantExprCompoundIfExpr]
168-
# flags: --warn-unreachable --enable-error-code=redundant-expr --python-version 3.10
168+
# flags: --warn-unreachable --enable-error-code=redundant-expr
169169

170170
from typing import Any, reveal_type
171171
from collections.abc import Iterable

test-data/unit/check-generic-subtyping.test

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@ main:15: error: Item "V" of the upper bound "U | V | W" of type variable "T" has
872872

873873

874874
[case testTypeVarBoundToNewUnionAttributeAccess]
875-
# flags: --python-version 3.10
876875
from typing import TypeVar
877876

878877
class U:
@@ -891,12 +890,12 @@ def f(x: T) -> None:
891890

892891
[builtins fixtures/tuple.pyi]
893892
[out]
894-
main:14: error: Item "V" of the upper bound "U | V | W" of type variable "T" has no attribute "a"
895-
main:14: error: Item "W" of the upper bound "U | V | W" of type variable "T" has no attribute "a"
896-
main:15: error: Item "U" of the upper bound "U | V | W" of type variable "T" has no attribute "b"
897-
main:15: error: Item "W" of the upper bound "U | V | W" of type variable "T" has no attribute "b"
898-
main:16: error: Item "U" of the upper bound "U | V | W" of type variable "T" has no attribute "c"
899-
main:16: error: Item "V" of the upper bound "U | V | W" of type variable "T" has no attribute "c"
893+
main:13: error: Item "V" of the upper bound "U | V | W" of type variable "T" has no attribute "a"
894+
main:13: error: Item "W" of the upper bound "U | V | W" of type variable "T" has no attribute "a"
895+
main:14: error: Item "U" of the upper bound "U | V | W" of type variable "T" has no attribute "b"
896+
main:14: error: Item "W" of the upper bound "U | V | W" of type variable "T" has no attribute "b"
897+
main:15: error: Item "U" of the upper bound "U | V | W" of type variable "T" has no attribute "c"
898+
main:15: error: Item "V" of the upper bound "U | V | W" of type variable "T" has no attribute "c"
900899

901900

902901
[case testSubtypingIterableUnpacking1]

test-data/unit/check-incremental.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7055,7 +7055,6 @@ def guard(x: object) -> TypeIs[int]:
70557055
[builtins fixtures/tuple.pyi]
70567056

70577057
[case testStartUsingPEP604Union]
7058-
# flags: --python-version 3.10
70597058
import a
70607059
[file a.py]
70617060
import lib

test-data/unit/check-inference.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3623,7 +3623,7 @@ if x:
36233623
[builtins fixtures/dict.pyi]
36243624

36253625
[case testAllowPlainNoneForPartialAtModuleScope]
3626-
# flags: --local-partial-types --python-version 3.10
3626+
# flags: --local-partial-types
36273627
x = None
36283628
reveal_type(x) # N: Revealed type is "None"
36293629

test-data/unit/check-namedtuple.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,6 @@ def f(fields) -> None:
11551155
[builtins fixtures/tuple.pyi]
11561156

11571157
[case testNamedTupleHasMatchArgs]
1158-
# flags: --python-version 3.10
11591158
from typing import NamedTuple
11601159
class One(NamedTuple):
11611160
bar: int

test-data/unit/check-narrowing.test

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ else:
16891689

16901690

16911691
[case testNarrowingWithTupleOfTypesPy310Plus]
1692-
# flags: --python-version 3.10 --strict-equality --warn-unreachable
1692+
# flags: --strict-equality --warn-unreachable
16931693
class Base: ...
16941694

16951695
class Impl1(Base): ...
@@ -2373,7 +2373,7 @@ def f(cls: Type[Union[None, int]]) -> None:
23732373
[builtins fixtures/isinstance.pyi]
23742374

23752375
[case testNarrowingIsSubclassNoneType4]
2376-
# flags: --python-version 3.10 --strict-equality --warn-unreachable
2376+
# flags: --strict-equality --warn-unreachable
23772377

23782378
from types import NoneType
23792379
from typing import Type, Union
@@ -2386,7 +2386,7 @@ def f(cls: Type[Union[None, int]]) -> None:
23862386
[builtins fixtures/isinstance.pyi]
23872387

23882388
[case testNarrowingIsInstanceNoIntersectionWithFinalTypeAndNoneType]
2389-
# flags: --warn-unreachable --python-version 3.10 --strict-equality
2389+
# flags: --warn-unreachable --strict-equality
23902390

23912391
from types import NoneType
23922392
from typing import final
@@ -2620,7 +2620,7 @@ def foo(location: ParameterLocation):
26202620
[builtins fixtures/primitives.pyi]
26212621

26222622
[case testConsistentNarrowingEqAndIn]
2623-
# flags: --python-version 3.10 --strict-equality --warn-unreachable
2623+
# flags: --strict-equality --warn-unreachable
26242624

26252625
# https://github.com/python/mypy/issues/17864
26262626
def f(x: str | int) -> None:
@@ -2636,7 +2636,7 @@ def f(x: str | int) -> None:
26362636
[builtins fixtures/primitives.pyi]
26372637

26382638
[case testConsistentNarrowingEqAndInWithCustomEq]
2639-
# flags: --python-version 3.10 --strict-equality --warn-unreachable
2639+
# flags: --strict-equality --warn-unreachable
26402640

26412641
# https://github.com/python/mypy/issues/17864
26422642
class C:
@@ -3063,7 +3063,7 @@ reveal_type(t.foo) # N: Revealed type is "__main__.C"
30633063
[builtins fixtures/property.pyi]
30643064

30653065
[case testNarrowingNotImplemented]
3066-
# flags: --python-version 3.10 --warn-unreachable
3066+
# flags: --warn-unreachable
30673067
from __future__ import annotations
30683068
import types
30693069

test-data/unit/check-parameter-specification.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ reveal_type(whatever(217)) # N: Revealed type is "builtins.list[builtins.int]"
142142
[builtins fixtures/paramspec.pyi]
143143

144144
[case testInvalidParamSpecType]
145-
# flags: --python-version 3.10
146145
from typing import ParamSpec
147146

148147
P = ParamSpec("P")

test-data/unit/check-plugin-attrs.test

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,6 @@ NoSlots.__slots__ # E: "type[NoSlots]" has no attribute "__slots__"
17881788
[builtins fixtures/plugin_attrs.pyi]
17891789

17901790
[case testAttrsWithMatchArgs]
1791-
# flags: --python-version 3.10
17921791
import attr
17931792

17941793
@attr.s(match_args=True, auto_attribs=True)
@@ -1804,7 +1803,6 @@ reveal_type(ToMatch(1, 2, z=3).__match_args__) # N: Revealed type is "tuple
18041803
[builtins fixtures/plugin_attrs.pyi]
18051804

18061805
[case testAttrsWithMatchArgsDefaultCase]
1807-
# flags: --python-version 3.10
18081806
import attr
18091807

18101808
@attr.s(auto_attribs=True)
@@ -1825,7 +1823,6 @@ reveal_type(t2.__match_args__) # N: Revealed type is "tuple[Literal['x']?, Lite
18251823
[builtins fixtures/plugin_attrs.pyi]
18261824

18271825
[case testAttrsWithMatchArgsOverrideExisting]
1828-
# flags: --python-version 3.10
18291826
import attr
18301827
from typing import Final
18311828

@@ -1848,7 +1845,6 @@ reveal_type(WithoutMatch(x=1, y=2).__match_args__) # N: Revealed type is "tuple
18481845
[builtins fixtures/plugin_attrs.pyi]
18491846

18501847
[case testAttrsMultipleInheritance]
1851-
# flags: --python-version 3.10
18521848
import attr
18531849

18541850
@attr.s
@@ -2169,7 +2165,6 @@ reveal_type(a2) # N: Revealed type is "__main__.A[builtins.int]"
21692165
[builtins fixtures/plugin_attrs.pyi]
21702166

21712167
[case testEvolveUnion]
2172-
# flags: --python-version 3.10
21732168
from typing import Generic, TypeVar
21742169
import attrs
21752170

@@ -2199,7 +2194,6 @@ a2 = attrs.evolve(a_or_b, x=42, y=True, w={}) # E: Argument "w" to "evolve" of
21992194
[builtins fixtures/plugin_attrs.pyi]
22002195

22012196
[case testEvolveUnionOfTypeVar]
2202-
# flags: --python-version 3.10
22032197
import attrs
22042198
from typing import TypeVar
22052199

0 commit comments

Comments
 (0)