mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 12:36:54 +00:00
Add tests for noqa without a space
This commit is contained in:
parent
c645a6761d
commit
8c9c462154
2 changed files with 10 additions and 0 deletions
|
|
@ -69,9 +69,13 @@ def test_strip_utf_bom(first_line):
|
|||
([u'\uFEFF"""Module docstring."""\n'], False),
|
||||
(['#!/usr/bin/python', '# flake8 is great', 'a = 1'], False),
|
||||
(['#!/usr/bin/python', '# flake8: noqa', 'a = 1'], True),
|
||||
(['#!/usr/bin/python', '# flake8:noqa', 'a = 1'], True),
|
||||
(['# flake8: noqa', '#!/usr/bin/python', 'a = 1'], True),
|
||||
(['# flake8:noqa', '#!/usr/bin/python', 'a = 1'], True),
|
||||
(['#!/usr/bin/python', 'a = 1', '# flake8: noqa'], True),
|
||||
(['#!/usr/bin/python', 'a = 1', '# flake8:noqa'], True),
|
||||
(['#!/usr/bin/python', 'a = 1 # flake8: noqa'], False),
|
||||
(['#!/usr/bin/python', 'a = 1 # flake8:noqa'], False),
|
||||
])
|
||||
def test_should_ignore_file(lines, expected):
|
||||
"""Verify that we ignore a file if told to."""
|
||||
|
|
|
|||
|
|
@ -13,10 +13,16 @@ from flake8 import style_guide
|
|||
('W123', 'a = 1 # noqa: E111,W123,F821', True),
|
||||
('W123', 'a = 1 # noqa: E111, W123,F821', True),
|
||||
('E111', 'a = 1 # noqa: E11,W123,F821', True),
|
||||
('E121', 'a = 1 # noqa:E111,W123,F821', False),
|
||||
('E111', 'a = 1 # noqa:E111,W123,F821', True),
|
||||
('W123', 'a = 1 # noqa:E111,W123,F821', True),
|
||||
('W123', 'a = 1 # noqa:E111, W123,F821', True),
|
||||
('E111', 'a = 1 # noqa:E11,W123,F821', True),
|
||||
('E111', 'a = 1 # noqa, analysis:ignore', True),
|
||||
('E111', 'a = 1 # noqa analysis:ignore', True),
|
||||
('E111', 'a = 1 # noqa - We do not care', True),
|
||||
('E111', 'a = 1 # noqa: We do not care', True),
|
||||
('E111', 'a = 1 # noqa:We do not care', True),
|
||||
])
|
||||
def test_is_inline_ignored(error_code, physical_line, expected_result):
|
||||
"""Verify that we detect inline usage of ``# noqa``."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue