mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-11 07:14:18 +00:00
Add unit test for build_ast
This commit is contained in:
parent
698af80514
commit
7de8a058dd
1 changed files with 11 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
"""Tests for the FileProcessor class."""
|
"""Tests for the FileProcessor class."""
|
||||||
|
import ast
|
||||||
import optparse
|
import optparse
|
||||||
|
|
||||||
from flake8 import processor
|
from flake8 import processor
|
||||||
|
|
@ -156,3 +157,13 @@ def test_split_line(unsplit_line, expected_lines):
|
||||||
assert expected_lines == actual_lines
|
assert expected_lines == actual_lines
|
||||||
|
|
||||||
assert len(actual_lines) == file_processor.line_number
|
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue