mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 21:16:54 +00:00
Add checking for inline #noqa comments
This also supports ignoring only specified codes
This commit is contained in:
parent
a9a939cbbc
commit
f4b18229a0
2 changed files with 53 additions and 3 deletions
|
|
@ -142,7 +142,8 @@ def test_handle_error_notifies_listeners(select_list, ignore_list, error_code):
|
|||
listener_trie=listener_trie,
|
||||
formatter=formatter)
|
||||
|
||||
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
|
||||
with mock.patch('linecache.getline', return_value=''):
|
||||
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
|
||||
error = style_guide.Error(error_code, 'stdin', 1, 1, 'error found')
|
||||
listener_trie.notify.assert_called_once_with(error_code, error)
|
||||
formatter.handle.assert_called_once_with(error)
|
||||
|
|
@ -170,6 +171,7 @@ def test_handle_error_does_not_notify_listeners(select_list, ignore_list,
|
|||
listener_trie=listener_trie,
|
||||
formatter=formatter)
|
||||
|
||||
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
|
||||
with mock.patch('linecache.getline', return_value=''):
|
||||
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
|
||||
assert listener_trie.notify.called is False
|
||||
assert formatter.handle.called is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue