mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-11 15:24:18 +00:00
Rename style_guide.Error to style_guide.Violation
Move all Violation related methods from the StyleGuide to our Violation class.
This commit is contained in:
parent
65107a5624
commit
92c367dee4
9 changed files with 185 additions and 136 deletions
|
|
@ -17,14 +17,15 @@ def test_caches_filenames_already_printed():
|
|||
formatter = default.FilenameOnly(options())
|
||||
assert formatter.filenames_already_printed == set()
|
||||
|
||||
formatter.format(style_guide.Error('code', 'file.py', 1, 1, 'text', 'l'))
|
||||
formatter.format(
|
||||
style_guide.Violation('code', 'file.py', 1, 1, 'text', 'l'))
|
||||
assert formatter.filenames_already_printed == {'file.py'}
|
||||
|
||||
|
||||
def test_only_returns_a_string_once_from_format():
|
||||
"""Verify format ignores the second error with the same filename."""
|
||||
formatter = default.FilenameOnly(options())
|
||||
error = style_guide.Error('code', 'file.py', 1, 1, 'text', '1')
|
||||
error = style_guide.Violation('code', 'file.py', 1, 1, 'text', '1')
|
||||
|
||||
assert formatter.format(error) == 'file.py'
|
||||
assert formatter.format(error) is None
|
||||
|
|
@ -33,6 +34,6 @@ def test_only_returns_a_string_once_from_format():
|
|||
def test_show_source_returns_nothing():
|
||||
"""Verify show_source returns nothing."""
|
||||
formatter = default.FilenameOnly(options())
|
||||
error = style_guide.Error('code', 'file.py', 1, 1, 'text', '1')
|
||||
error = style_guide.Violation('code', 'file.py', 1, 1, 'text', '1')
|
||||
|
||||
assert formatter.show_source(error) is None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue