diff options
| author | Tomer Keren <tomer.keren.dev@gmail.com> | 2018-12-27 18:07:04 +0200 |
|---|---|---|
| committer | Tomer Keren <tomer.keren.dev@gmail.com> | 2018-12-27 18:14:20 +0200 |
| commit | 8c9c462154d3971d9f1ed6e6d38098845d8901a1 (patch) | |
| tree | dac115fa6dacd4e1bc09a7e5bdac6137dc4c9959 /tests/unit | |
| parent | c645a6761d406374921ce58c70774faa810320a3 (diff) | |
| download | flake8-8c9c462154d3971d9f1ed6e6d38098845d8901a1.tar.gz | |
Add tests for noqa without a space
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_file_processor.py | 4 | ||||
| -rw-r--r-- | tests/unit/test_violation.py | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index 0c2dc99..7d64f6e 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -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.""" diff --git a/tests/unit/test_violation.py b/tests/unit/test_violation.py index c4b56b1..e29d874 100644 --- a/tests/unit/test_violation.py +++ b/tests/unit/test_violation.py @@ -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``.""" |
