mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-31 19:26:52 +00:00
Add test for FileProcessor#split_line
This commit is contained in:
parent
82dd4f6d25
commit
698af80514
1 changed files with 18 additions and 0 deletions
|
|
@ -138,3 +138,21 @@ def test_keyword_arguments_for_does_not_handle_attribute_errors():
|
|||
|
||||
with pytest.raises(AttributeError):
|
||||
file_processor.keyword_arguments_for(['fake'])
|
||||
|
||||
|
||||
@pytest.mark.parametrize('unsplit_line, expected_lines', [
|
||||
('line', []),
|
||||
('line 1\n', ['line 1']),
|
||||
('line 1\nline 2\n', ['line 1', 'line 2']),
|
||||
('line 1\n\nline 2\n', ['line 1', '', 'line 2']),
|
||||
])
|
||||
def test_split_line(unsplit_line, expected_lines):
|
||||
"""Verify the token line spliting."""
|
||||
file_processor = processor.FileProcessor('-', options_from(), lines=[
|
||||
'Line 1',
|
||||
])
|
||||
|
||||
actual_lines = list(file_processor.split_line((1, unsplit_line)))
|
||||
assert expected_lines == actual_lines
|
||||
|
||||
assert len(actual_lines) == file_processor.line_number
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue