diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-20 19:28:13 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-20 19:28:13 -0500 |
| commit | a1fdb5a2b5934ef5629df2335b2d495ba5252812 (patch) | |
| tree | f95ce2e638dc3bf722cd4c6a615dda8d29e66c58 /tests/unit | |
| parent | 7934f8dce2fc1c5d8da374a3c7435d36f9526b0b (diff) | |
| download | flake8-a1fdb5a2b5934ef5629df2335b2d495ba5252812.tar.gz | |
Fix up merge request 78
This simplifies the changes, reduces the scope of refactors apparently
for refactoring's sake and ensures that the internals are reasonable.
It also airs on the side of preserving information rather than
discarding or overwriting it.
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_file_processor.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index 8bc0e2d..547d6a0 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -14,7 +14,7 @@ def options_from(**kwargs): kwargs.setdefault('hang_closing', True) kwargs.setdefault('max_line_length', 79) kwargs.setdefault('verbose', False) - kwargs.setdefault('stdin_display_name', None) + kwargs.setdefault('stdin_display_name', 'stdin') return optparse.Values(kwargs) @@ -71,10 +71,18 @@ def test_stdin_filename_attribute(stdin_get_value): stdin_get_value.return_value = stdin_value file_processor = processor.FileProcessor('-', options_from()) assert file_processor.filename == 'stdin' + + +@mock.patch('flake8.utils.stdin_get_value') +def test_read_lines_uses_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="foo.py" + stdin_display_name='display_name.py' )) - assert file_processor.filename == 'foo.py' + assert file_processor.filename == 'display_name.py' def test_line_for(): |
