mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 12:16:53 +00:00
Add failing test for NoneType in handle_error
There are rare cases when StyleGuide#handle_error might receive None as the column_number. This adds the failing test to ensure we don't regress the correct behaviour. Related-to #214
This commit is contained in:
parent
e8cb26895e
commit
1631ab8ac7
1 changed files with 13 additions and 0 deletions
|
|
@ -185,6 +185,19 @@ def test_handle_error_notifies_listeners(select_list, ignore_list, error_code):
|
|||
formatter.handle.assert_called_once_with(error)
|
||||
|
||||
|
||||
def test_handle_error_does_not_raise_type_errors():
|
||||
"""Verify that we handle our inputs better."""
|
||||
listener_trie = mock.create_autospec(notifier.Notifier, instance=True)
|
||||
formatter = mock.create_autospec(base.BaseFormatter, instance=True)
|
||||
guide = style_guide.StyleGuide(create_options(select=['T111'], ignore=[]),
|
||||
listener_trie=listener_trie,
|
||||
formatter=formatter)
|
||||
|
||||
assert 1 == guide.handle_error(
|
||||
'T111', 'file.py', 1, None, 'error found', 'a = 1'
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('select_list,ignore_list,error_code', [
|
||||
(['E111', 'E121'], [], 'E122'),
|
||||
(['E11', 'E12'], [], 'E132'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue