summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-08-28 00:58:19 +0000
committerIan Cordasco <graffatcolmingov@gmail.com>2016-08-28 00:58:19 +0000
commitc17043ff3f245e2ead27c6edde3c9f9ddca0e99f (patch)
tree5f57cc508d8df6e33db44899be1f9ea025183543 /tests
parenta09c9acaaf9beb16afdfb788b5b8ab4dd65ca4bd (diff)
parent585628875d29f4a46d8adbccc0e1bfa7b3a4a347 (diff)
downloadflake8-c17043ff3f245e2ead27c6edde3c9f9ddca0e99f.tar.gz
Merge branch 'bug/214' into 'master'
Avoid TypeErrors when handling a SyntaxError See merge request !121
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_style_guide.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit/test_style_guide.py b/tests/unit/test_style_guide.py
index 64a7fcd..8e714b7 100644
--- a/tests/unit/test_style_guide.py
+++ b/tests/unit/test_style_guide.py
@@ -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'),