summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2017-06-01 20:36:37 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2017-06-01 20:36:37 -0500
commit7fef0af0f5521a8cec8451cb8dd01952acd78408 (patch)
treeb325136f45dc511a114e69300206e5ea03c12f56 /tests
parentfeec0754bd2f9c1f3b64ac309481cdfe40162bb7 (diff)
downloadflake8-7fef0af0f5521a8cec8451cb8dd01952acd78408.tar.gz
Refactor decision logic into its own object
In dealing with the decision logic in the StyleGuide recently I recognized that the logic really doesn't belong strictly on the StyleGuide. A separate object makes perfect sense especially from the perspective of testability. This is a minor refactor intended solely to facilitate further testing and perhaps making the logic easier to understand for others.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_style_guide.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/unit/test_style_guide.py b/tests/unit/test_style_guide.py
index 5c24048..bfef893 100644
--- a/tests/unit/test_style_guide.py
+++ b/tests/unit/test_style_guide.py
@@ -183,22 +183,16 @@ def test_should_report_error(select_list, ignore_list, error_code, expected):
)
def test_decision_for_logic(select, ignore, extend_select, enabled_extensions,
error_code, expected):
- """Verify the complicated logic of StyleGuide._decision_for.
-
- I usually avoid testing private methods, but this one is very important in
- our conflict resolution work in Flake8.
- """
- guide = style_guide.StyleGuide(
+ """Verify the complicated logic of DecisionEngine.decision_for."""
+ decider = style_guide.DecisionEngine(
create_options(
select=select, ignore=ignore,
extended_default_select=extend_select,
enable_extensions=enabled_extensions,
),
- listener_trie=None,
- formatter=None,
)
- assert guide._decision_for(error_code) is expected
+ assert decider.decision_for(error_code) is expected
@pytest.mark.parametrize('error_code,physical_line,expected_result', [