Skip to content

Commit 0727850

Browse files
authored
fix test failures in python 3.12 (#777)
1 parent ad5e15f commit 0727850

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pyflakes/test/test_api.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,11 @@ def foo(bar=baz, bax):
474474
pass
475475
"""
476476
with self.makeTempFile(source) as sourcePath:
477+
if sys.version_info >= (3, 12):
478+
msg = 'parameter without a default follows parameter with a default' # noqa: E501
479+
else:
480+
msg = 'non-default argument follows default argument'
481+
477482
if PYPY and sys.version_info >= (3, 9):
478483
column = 18
479484
elif PYPY:
@@ -485,13 +490,13 @@ def foo(bar=baz, bax):
485490
else:
486491
column = 9
487492
last_line = ' ' * (column - 1) + '^\n'
488-
columnstr = '%d:' % column
489493
self.assertHasErrors(
490494
sourcePath,
491-
["""\
492-
{}:1:{} non-default argument follows default argument
495+
[f"""\
496+
{sourcePath}:1:{column}: {msg}
493497
def foo(bar=baz, bax):
494-
{}""".format(sourcePath, columnstr, last_line)])
498+
{last_line}"""]
499+
)
495500

496501
def test_nonKeywordAfterKeywordSyntaxError(self):
497502
"""
@@ -532,7 +537,7 @@ def test_invalidEscape(self):
532537
column = 7
533538
elif PYPY:
534539
column = 6
535-
elif sys.version_info >= (3, 9):
540+
elif (3, 9) <= sys.version_info < (3, 12):
536541
column = 13
537542
else:
538543
column = 7

0 commit comments

Comments
 (0)