Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8ed1e3a

Browse filesBrowse files
AlexWaygoodmiss-islington
authored andcommitted
pythongh-102444: Fix minor bugs in test_typing highlighted by pyflakes (pythonGH-102445)
(cherry picked from commit 96e1022) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent db8d10b commit 8ed1e3a
Copy full SHA for 8ed1e3a

File tree

1 file changed

+2
-19
lines changed
Filter options

1 file changed

+2
-19
lines changed

‎Lib/test/test_typing.py

Copy file name to clipboardExpand all lines: Lib/test/test_typing.py
+2-19Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ def test_var_substitution(self):
469469

470470
def test_bad_var_substitution(self):
471471
T = TypeVar('T')
472-
P = ParamSpec("P")
473472
bad_args = (
474473
(), (int, str), Union,
475474
Generic, Generic[T], Protocol, Protocol[T],
@@ -1033,8 +1032,6 @@ class G2(Generic[Unpack[Ts]]): pass
10331032

10341033
def test_repr_is_correct(self):
10351034
Ts = TypeVarTuple('Ts')
1036-
T = TypeVar('T')
1037-
T2 = TypeVar('T2')
10381035

10391036
class G1(Generic[*Ts]): pass
10401037
class G2(Generic[Unpack[Ts]]): pass
@@ -1304,7 +1301,7 @@ def test_callable_args_are_correct(self):
13041301
i = Callable[[None], *Ts]
13051302
j = Callable[[None], Unpack[Ts]]
13061303
self.assertEqual(i.__args__, (type(None), *Ts))
1307-
self.assertEqual(i.__args__, (type(None), Unpack[Ts]))
1304+
self.assertEqual(j.__args__, (type(None), Unpack[Ts]))
13081305

13091306
k = Callable[[None], tuple[int, *Ts]]
13101307
l = Callable[[None], Tuple[int, Unpack[Ts]]]
@@ -1432,8 +1429,6 @@ def g(*args: *Ts): pass
14321429
self.assertEqual(g.__annotations__, {'args': (*Ts,)[0]})
14331430

14341431
def test_variadic_args_with_ellipsis_annotations_are_correct(self):
1435-
Ts = TypeVarTuple('Ts')
1436-
14371432
def a(*args: *tuple[int, ...]): pass
14381433
self.assertEqual(a.__annotations__,
14391434
{'args': (*tuple[int, ...],)[0]})
@@ -4769,7 +4764,6 @@ def test_overload_registry_repeated(self):
47694764
# Definitions needed for features introduced in Python 3.6
47704765

47714766
from test import ann_module, ann_module2, ann_module3, ann_module5, ann_module6
4772-
import asyncio
47734767

47744768
T_a = TypeVar('T_a')
47754769

@@ -6898,16 +6892,6 @@ class C:
68986892
self.assertEqual(get_type_hints(C, globals())['classvar'], ClassVar[int])
68996893
self.assertEqual(get_type_hints(C, globals())['const'], Final[int])
69006894

6901-
def test_hash_eq(self):
6902-
self.assertEqual(len({Annotated[int, 4, 5], Annotated[int, 4, 5]}), 1)
6903-
self.assertNotEqual(Annotated[int, 4, 5], Annotated[int, 5, 4])
6904-
self.assertNotEqual(Annotated[int, 4, 5], Annotated[str, 4, 5])
6905-
self.assertNotEqual(Annotated[int, 4], Annotated[int, 4, 4])
6906-
self.assertEqual(
6907-
{Annotated[int, 4, 5], Annotated[int, 4, 5], Annotated[T, 4, 5]},
6908-
{Annotated[int, 4, 5], Annotated[T, 4, 5]}
6909-
)
6910-
69116895
def test_cannot_subclass(self):
69126896
with self.assertRaisesRegex(TypeError, "Cannot subclass .*Annotated"):
69136897
class C(Annotated):
@@ -7335,7 +7319,6 @@ class Y(Generic[P, T]):
73357319
self.assertEqual(B.__args__, ((int, str,), Tuple[bytes, float]))
73367320

73377321
def test_var_substitution(self):
7338-
T = TypeVar("T")
73397322
P = ParamSpec("P")
73407323
subst = P.__typing_subst__
73417324
self.assertEqual(subst((int, str)), (int, str))
@@ -7628,7 +7611,7 @@ def test_special_attrs2(self):
76287611
self.assertEqual(fr.__module__, 'typing')
76297612
# Forward refs are currently unpicklable.
76307613
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
7631-
with self.assertRaises(TypeError) as exc:
7614+
with self.assertRaises(TypeError):
76327615
pickle.dumps(fr, proto)
76337616

76347617
self.assertEqual(SpecialAttrsTests.TypeName.__name__, 'TypeName')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.