diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-10-28 07:09:43 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-10-28 07:09:43 -0500 |
| commit | 352a7250b7f2f86d22a8172583b100e748fb70f9 (patch) | |
| tree | 606543bd67360f2f925cb69cad88fd4223bae409 /tests | |
| parent | 185a073c296e2276597b564d31796e9cd38f7b93 (diff) | |
| download | flake8-352a7250b7f2f86d22a8172583b100e748fb70f9.tar.gz | |
Handle empty stdin-display-name values
Apparently, some folks pass an empty string to --stdin-display-name. To
avoid the errors this causes, we need to handle it appropriately.
Closes #235
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_file_processor.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index 001a6ba..c534003 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -86,6 +86,18 @@ def test_read_lines_uses_display_name(stdin_get_value): assert file_processor.filename == 'display_name.py' +@mock.patch('flake8.utils.stdin_get_value') +def test_read_lines_ignores_empty_display_name(stdin_get_value): + """Verify that when processing stdin we use a display name if present.""" + stdin_value = mock.Mock() + stdin_value.splitlines.return_value = [] + stdin_get_value.return_value = stdin_value + file_processor = processor.FileProcessor('-', options_from( + stdin_display_name='' + )) + assert file_processor.filename == 'stdin' + + def test_line_for(): """Verify we grab the correct line from the cached lines.""" file_processor = processor.FileProcessor('-', options_from(), lines=[ |
