From 7de8a058dd79cf2be65530402089aec8cca61b2c Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Mon, 28 Mar 2016 19:43:14 -0500 Subject: [PATCH] Add unit test for build_ast --- tests/unit/test_file_processor.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index bfa3e55..fba104a 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -1,4 +1,5 @@ """Tests for the FileProcessor class.""" +import ast import optparse from flake8 import processor @@ -156,3 +157,13 @@ def test_split_line(unsplit_line, expected_lines): assert expected_lines == actual_lines assert len(actual_lines) == file_processor.line_number + + +def test_build_ast(): + """Verify the logic for how we build an AST for plugins.""" + file_processor = processor.FileProcessor('-', options_from(), lines=[ + 'a = 1\n' + ]) + + module = file_processor.build_ast() + assert isinstance(module, ast.Module)