mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
Merge branch 'bug/157' into 'master'
Handle errors reported in empty files *Description of changes* Some plugins return errors in empty files which previously caused an IndexError. *Related to:* #157 See merge request !71
This commit is contained in:
commit
edd84fba52
3 changed files with 19 additions and 4 deletions
|
|
@ -51,7 +51,15 @@ def test_show_source_returns_nothing_when_not_showing_source():
|
|||
formatter = base.BaseFormatter(options(show_source=False))
|
||||
assert formatter.show_source(
|
||||
style_guide.Error('A000', 'file.py', 1, 1, 'error text', 'line')
|
||||
) is None
|
||||
) is ''
|
||||
|
||||
|
||||
def test_show_source_returns_nothing_when_there_is_source():
|
||||
"""Ensure we return nothing when there is no line."""
|
||||
formatter = base.BaseFormatter(options(show_source=True))
|
||||
assert formatter.show_source(
|
||||
style_guide.Error('A000', 'file.py', 1, 1, 'error text', None)
|
||||
) is ''
|
||||
|
||||
|
||||
@pytest.mark.parametrize('line, column', [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue