Skip to content

Commit dabc4a1

Browse files
cdce8pericmarkmartin
authored andcommitted
Update a few more imports in tests (python#18655)
1 parent f5da233 commit dabc4a1

12 files changed

+35
-43
lines changed

mypyc/test-data/irbuild-match.test

+1-1
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

+1-1
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

+1-2
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

+2-2
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

+14-14
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

+1-1
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

+5-7
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

+1-2
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

+3-4
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

+2-3
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: ...

test-data/unit/check-selftype.test

+2-4
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,7 @@ BadSub().get_item() # E: Invalid self argument "BadSub" to attribute function "
856856
[builtins fixtures/list.pyi]
857857

858858
[case testMixinAllowedWithProtocol]
859-
from typing import TypeVar
860-
from typing_extensions import Protocol
859+
from typing import Protocol, TypeVar
861860

862861
class Resource(Protocol):
863862
def close(self) -> int: ...
@@ -908,8 +907,7 @@ class Bad:
908907
class CC(TweakFunc, Bad): pass # E: Definition of "func" in base class "TweakFunc" is incompatible with definition in base class "Bad"
909908

910909
[case testBadClassLevelDecoratorHack]
911-
from typing_extensions import Protocol
912-
from typing import TypeVar, Any
910+
from typing import Protocol, TypeVar, Any
913911

914912
class FuncLike(Protocol):
915913
__call__: Any

test-data/unit/check-semanal-error.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ def f() -> None: ... # E: Name "f" already defined (possibly by an import)
137137
[out]
138138

139139
[case testRuntimeProtoTwoBases]
140-
from typing_extensions import Protocol, runtime_checkable
141-
from typing import TypeVar, Generic
140+
from typing import TypeVar, Generic, Protocol, runtime_checkable
142141

143142
T = TypeVar('T')
144143

@@ -151,6 +150,7 @@ class C:
151150

152151
x: P[int] = C()
153152
[builtins fixtures/tuple.pyi]
153+
[typing fixtures/typing-full.pyi]
154154

155155
[case testSemanalDoesNotLeakSyntheticTypes]
156156
# flags: --cache-fine-grained

0 commit comments

Comments
 (0)