Skip to content

Commit 2a61f3c

Browse files
authored
add tests for python3.11-specific syntax (#694)
1 parent e02336c commit 2a61f3c

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.7"]
15+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11.0-beta - 3.11.999", "pypy-3.7"]
1616
os: [ubuntu-latest]
1717
# Include minimum py3 + maximum py3 + pypy3 on Windows
1818
include:

pyflakes/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,7 @@ def TRY(self, node):
23462346
# Process the other nodes: "except:", "else:", "finally:"
23472347
self.handleChildren(node, omit='body')
23482348

2349-
TRYEXCEPT = TRY
2349+
TRYEXCEPT = TRYSTAR = TRY
23502350

23512351
def EXCEPTHANDLER(self, node):
23522352
if PY2 or node.name is None:

pyflakes/test/test_other.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,15 @@ def test_exceptionUnusedInExcept(self):
16681668
except Exception as e: pass
16691669
''', m.UnusedVariable)
16701670

1671+
@skipIf(version_info < (3, 11), 'new in Python 3.11')
1672+
def test_exception_unused_in_except_star(self):
1673+
self.flakes('''
1674+
try:
1675+
pass
1676+
except* OSError as e:
1677+
pass
1678+
''', m.UnusedVariable)
1679+
16711680
def test_exceptionUnusedInExceptInFunction(self):
16721681
self.flakes('''
16731682
def download_review():

pyflakes/test/test_type_annotations.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,3 +801,18 @@ class X(TypedDict):
801801
class Y(NamedTuple):
802802
y: NamedTuple("v", [("vv", int)])
803803
""")
804+
805+
@skipIf(version_info < (3, 11), 'new in Python 3.11')
806+
def test_variadic_generics(self):
807+
self.flakes("""
808+
from typing import Generic
809+
from typing import TypeVarTuple
810+
811+
Ts = TypeVarTuple('Ts')
812+
813+
class Shape(Generic[*Ts]): pass
814+
815+
def f(*args: *Ts) -> None: ...
816+
817+
def g(x: Shape[*Ts]) -> Shape[*Ts]: ...
818+
""")

0 commit comments

Comments
 (0)