Skip to content

Commit 562e9fa

Browse files
authored
Update a few more imports in tests (#18655)
1 parent f7f6bc2 commit 562e9fa

12 files changed

+35
-43
lines changed

mypyc/test-data/irbuild-match.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ L6:
17291729
unreachable
17301730

17311731
[case testMatchLiteralMatchArgs_python3_10]
1732-
from typing_extensions import Literal
1732+
from typing import Literal
17331733

17341734
class Foo:
17351735
__match_args__: tuple[Literal["foo"]] = ("foo",)

mypyc/test-data/run-classes.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ assert b.z is None
10681068
assert not hasattr(b, 'bogus')
10691069

10701070
[case testProtocol]
1071-
from typing_extensions import Protocol
1071+
from typing import Protocol
10721072

10731073
class Proto(Protocol):
10741074
def foo(self, x: int) -> None:

mypyc/test-data/run-misc.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,7 @@ for a in sorted(s):
612612
9 8 72
613613

614614
[case testDummyTypes]
615-
from typing import Tuple, List, Dict, Literal, NamedTuple, TypedDict
616-
from typing_extensions import NewType
615+
from typing import Tuple, List, Dict, Literal, NamedTuple, NewType, TypedDict
617616

618617
class A:
619618
pass

mypyc/test-data/run-multimodule.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ class Bar:
495495
bar(self)
496496

497497
[file other.py]
498-
from typing_extensions import TYPE_CHECKING
498+
from typing import TYPE_CHECKING
499499
MYPY = False
500500
if MYPY:
501501
from native import Foo
@@ -525,7 +525,7 @@ def f(c: 'C') -> int:
525525
return c.x
526526

527527
[file other.py]
528-
from typing_extensions import TYPE_CHECKING
528+
from typing import TYPE_CHECKING
529529
if TYPE_CHECKING:
530530
from native import D
531531

test-data/unit/check-deprecated.test

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ for i in a: # E: function __main__.A.__iter__ is deprecated: no iteration
380380
[case testDeprecatedOverloadedInstanceMethods]
381381
# flags: --enable-error-code=deprecated
382382

383-
from typing import Iterator, Union
384-
from typing_extensions import deprecated, overload
383+
from typing import Iterator, Union, overload
384+
from typing_extensions import deprecated
385385

386386
class A:
387387
@overload
@@ -429,8 +429,8 @@ b.h("x") # E: function __main__.A.h is deprecated: use `h2` instead
429429
[case testDeprecatedOverloadedClassMethods]
430430
# flags: --enable-error-code=deprecated
431431

432-
from typing import Iterator, Union
433-
from typing_extensions import deprecated, overload
432+
from typing import Iterator, Union, overload
433+
from typing_extensions import deprecated
434434

435435
class A:
436436
@overload
@@ -487,8 +487,8 @@ b.h("x") # E: function __main__.A.h is deprecated: use `h2` instead
487487
[case testDeprecatedOverloadedStaticMethods]
488488
# flags: --enable-error-code=deprecated
489489

490-
from typing import Iterator, Union
491-
from typing_extensions import deprecated, overload
490+
from typing import Iterator, Union, overload
491+
from typing_extensions import deprecated
492492

493493
class A:
494494
@overload
@@ -545,8 +545,8 @@ b.h("x") # E: function __main__.A.h is deprecated: use `h2` instead
545545
[case testDeprecatedOverloadedSpecialMethods]
546546
# flags: --enable-error-code=deprecated
547547

548-
from typing import Iterator, Union
549-
from typing_extensions import deprecated, overload
548+
from typing import Iterator, Union, overload
549+
from typing_extensions import deprecated
550550

551551
class A:
552552
@overload
@@ -671,8 +671,8 @@ C().g = "x" # E: function __main__.C.g is deprecated: use g2 instead \
671671
[case testDeprecatedDescriptor]
672672
# flags: --enable-error-code=deprecated
673673

674-
from typing import Any, Optional, Union
675-
from typing_extensions import deprecated, overload
674+
from typing import Any, Optional, Union, overload
675+
from typing_extensions import deprecated
676676

677677
@deprecated("use E1 instead")
678678
class D1:
@@ -725,8 +725,8 @@ c.d3 = "x" # E: overload def (self: __main__.D3, obj: __main__.C, value: builti
725725
[case testDeprecatedOverloadedFunction]
726726
# flags: --enable-error-code=deprecated
727727

728-
from typing import Union
729-
from typing_extensions import deprecated, overload
728+
from typing import Union, overload
729+
from typing_extensions import deprecated
730730

731731
@overload
732732
def f(x: int) -> int: ...
@@ -788,8 +788,8 @@ m.g("x")
788788

789789
[file m.py]
790790

791-
from typing import Union
792-
from typing_extensions import deprecated, overload
791+
from typing import Union, overload
792+
from typing_extensions import deprecated
793793

794794
@overload
795795
@deprecated("work with str instead")

test-data/unit/check-errorcodes.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def g() -> int:
652652
x: List[int] # type: ignore[name-defined]
653653

654654
[case testErrorCodeProtocolProblemsIgnore]
655-
from typing_extensions import Protocol
655+
from typing import Protocol
656656

657657
class P(Protocol):
658658
def f(self, x: str) -> None: ...

test-data/unit/check-expressions.test

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,25 +1010,23 @@ y: Gen[Literal[1]] = assert_type(Gen(1), Gen[Literal[1]])
10101010
[builtins fixtures/tuple.pyi]
10111011

10121012
[case testAssertTypeUncheckedFunction]
1013-
from typing import assert_type
1014-
from typing_extensions import Literal
1013+
from typing import Literal, assert_type
10151014
def f():
10161015
x = 42
10171016
assert_type(x, Literal[42])
10181017
[out]
1019-
main:5: error: Expression is of type "Any", not "Literal[42]"
1020-
main:5: note: "assert_type" expects everything to be "Any" in unchecked functions
1018+
main:4: error: Expression is of type "Any", not "Literal[42]"
1019+
main:4: note: "assert_type" expects everything to be "Any" in unchecked functions
10211020
[builtins fixtures/tuple.pyi]
10221021

10231022
[case testAssertTypeUncheckedFunctionWithUntypedCheck]
10241023
# flags: --check-untyped-defs
1025-
from typing import assert_type
1026-
from typing_extensions import Literal
1024+
from typing import Literal, assert_type
10271025
def f():
10281026
x = 42
10291027
assert_type(x, Literal[42])
10301028
[out]
1031-
main:6: error: Expression is of type "int", not "Literal[42]"
1029+
main:5: error: Expression is of type "int", not "Literal[42]"
10321030
[builtins fixtures/tuple.pyi]
10331031

10341032
[case testAssertTypeNoPromoteUnion]

test-data/unit/check-modules.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,7 @@ def bar(x: Both, y: Both = ...) -> Both:
519519
[out]
520520

521521
[case testEllipsisDefaultArgValueInNonStubsMethods]
522-
from typing import Generic, TypeVar
523-
from typing_extensions import Protocol
522+
from typing import Generic, Protocol, TypeVar
524523
from abc import abstractmethod
525524

526525
T = TypeVar('T')

test-data/unit/check-namedtuple.test

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ a.y = 5 # E: Property "y" defined in "X" is read-only
6969

7070

7171
[case testTypingNamedTupleAttributesAreReadOnly]
72-
from typing import NamedTuple
73-
from typing_extensions import Protocol
72+
from typing import NamedTuple, Protocol
7473

7574
class HasX(Protocol):
7675
x: str
@@ -82,8 +81,8 @@ a: HasX = A("foo")
8281
a.x = "bar"
8382
[builtins fixtures/tuple.pyi]
8483
[out]
85-
main:10: error: Incompatible types in assignment (expression has type "A", variable has type "HasX")
86-
main:10: note: Protocol member HasX.x expected settable variable, got read-only attribute
84+
main:9: error: Incompatible types in assignment (expression has type "A", variable has type "HasX")
85+
main:9: note: Protocol member HasX.x expected settable variable, got read-only attribute
8786

8887

8988
[case testNamedTupleCreateWithPositionalArguments]

test-data/unit/check-protocols.test

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,8 +2339,7 @@ main:19: note: Protocol member AllSettable.b expected settable variable, got rea
23392339
main:19: note: <2 more conflict(s) not shown>
23402340

23412341
[case testProtocolsMoreConflictsNotShown]
2342-
from typing_extensions import Protocol
2343-
from typing import Generic, TypeVar
2342+
from typing import Generic, Protocol, TypeVar
23442343

23452344
T = TypeVar('T')
23462345

@@ -2862,7 +2861,7 @@ c1: SupportsClassGetItem = C()
28622861

28632862
[case testNoneVsProtocol]
28642863
# mypy: strict-optional
2865-
from typing_extensions import Protocol
2864+
from typing import Protocol
28662865

28672866
class MyHashable(Protocol):
28682867
def __hash__(self) -> int: ...

0 commit comments

Comments
 (0)