diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-03-17 15:16:15 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-03-17 15:16:15 -0500 |
| commit | 0fd276d5eedfc6cdeb40570934037eb9bbb06fbd (patch) | |
| tree | 398cd24a9694e991596fc8ed8736804ffa10e7cc /tests | |
| parent | 5cde4bebaeec732d21a568a81dfa791804cb1b35 (diff) | |
| download | flake8-0fd276d5eedfc6cdeb40570934037eb9bbb06fbd.tar.gz | |
Add a test for FileProcessor.should_ignore_file
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_file_processor.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index 30a5e30..6e72a12 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -32,3 +32,17 @@ def test_strip_utf_bom(first_line): file_processor = processor.FileProcessor('-', options_from(), lines[:]) assert file_processor.lines != lines assert file_processor.lines[0] == '"""Module docstring."""\n' + + +@pytest.mark.parametrize('lines, expected', [ + (['\xEF\xBB\xBF"""Module docstring."""\n'], False), + ([u'\uFEFF"""Module docstring."""\n'], False), + (['#!/usr/bin/python', '# flake8 is great', 'a = 1'], False), + (['#!/usr/bin/python', '# flake8: noqa', 'a = 1'], True), + (['# flake8: noqa', '#!/usr/bin/python', 'a = 1'], True), + (['#!/usr/bin/python', 'a = 1', '# flake8: noqa'], True), +]) +def test_should_ignore_file(lines, expected): + """Verify that we ignore a file if told to.""" + file_processor = processor.FileProcessor('-', options_from(), lines) + assert file_processor.should_ignore_file() is expected |
