mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
mute FSTRING_MIDDLE tokens
This commit is contained in:
parent
c8d75d9966
commit
43266a2e26
2 changed files with 39 additions and 1 deletions
|
|
@ -197,3 +197,35 @@ t.py:3:1: T001 '"""\\n'
|
|||
'''
|
||||
out, err = capsys.readouterr()
|
||||
assert out == expected
|
||||
|
||||
|
||||
def yields_logical_line(logical_line):
|
||||
yield 0, f"T001 {logical_line!r}"
|
||||
|
||||
|
||||
def test_logical_line_plugin(tmpdir, capsys):
|
||||
cfg_s = f"""\
|
||||
[flake8]
|
||||
extend-ignore = F
|
||||
[flake8:local-plugins]
|
||||
extension =
|
||||
T = {yields_logical_line.__module__}:{yields_logical_line.__name__}
|
||||
"""
|
||||
|
||||
cfg = tmpdir.join("tox.ini")
|
||||
cfg.write(cfg_s)
|
||||
|
||||
src = """\
|
||||
f'hello world'
|
||||
"""
|
||||
t_py = tmpdir.join("t.py")
|
||||
t_py.write_binary(src.encode())
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
assert main(("t.py", "--config", str(cfg))) == 1
|
||||
|
||||
expected = """\
|
||||
t.py:1:1: T001 "f'xxxxxxxxxxx'"
|
||||
"""
|
||||
out, err = capsys.readouterr()
|
||||
assert out == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue