-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from jamescooke/tokenize
Use tokens from Flake8 in analysis of blank lines
- Loading branch information
Showing
19 changed files
with
168 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import ast | ||
|
||
import pytest | ||
|
||
from flake8_aaa import Checker | ||
|
||
|
||
@pytest.fixture | ||
def checker(tmpdir) -> Checker: | ||
target_file = tmpdir.join('test.py') | ||
target_file.write('assert 1 + 2 == 3\n') | ||
tree = ast.parse(target_file.read()) | ||
return Checker(tree, ['assert 1 + 2 == 3\n'], target_file.strpath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import Generator | ||
|
||
import pytest | ||
|
||
from flake8_aaa.exceptions import TokensNotLoaded | ||
|
||
|
||
def test(checker) -> None: | ||
checker.load() | ||
|
||
result = checker.all_funcs() | ||
|
||
assert isinstance(result, Generator) | ||
assert list(result) == [] | ||
|
||
|
||
def test_not_loaded(checker) -> None: | ||
result = checker.all_funcs() | ||
|
||
assert isinstance(result, Generator) | ||
with pytest.raises(TokensNotLoaded): | ||
next(result) |
Oops, something went wrong.