Skip to content

Commit

Permalink
fix test failures in python 3.12 (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile authored Jun 13, 2023
1 parent ad5e15f commit 0727850
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pyflakes/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@ def foo(bar=baz, bax):
pass
"""
with self.makeTempFile(source) as sourcePath:
if sys.version_info >= (3, 12):
msg = 'parameter without a default follows parameter with a default' # noqa: E501
else:
msg = 'non-default argument follows default argument'

if PYPY and sys.version_info >= (3, 9):
column = 18
elif PYPY:
Expand All @@ -485,13 +490,13 @@ def foo(bar=baz, bax):
else:
column = 9
last_line = ' ' * (column - 1) + '^\n'
columnstr = '%d:' % column
self.assertHasErrors(
sourcePath,
["""\
{}:1:{} non-default argument follows default argument
[f"""\
{sourcePath}:1:{column}: {msg}
def foo(bar=baz, bax):
{}""".format(sourcePath, columnstr, last_line)])
{last_line}"""]
)

def test_nonKeywordAfterKeywordSyntaxError(self):
"""
Expand Down Expand Up @@ -532,7 +537,7 @@ def test_invalidEscape(self):
column = 7
elif PYPY:
column = 6
elif sys.version_info >= (3, 9):
elif (3, 9) <= sys.version_info < (3, 12):
column = 13
else:
column = 7
Expand Down

0 comments on commit 0727850

Please sign in to comment.