mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-06 21:04:29 +08:00
Add E292 (eof should end with newline) with tests.
This commit is contained in:
20
test/test_pep8.py
Normal file
20
test/test_pep8.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import parso
|
||||
|
||||
|
||||
def issues(code):
|
||||
module = parso.parse(code)
|
||||
return module._get_normalizer_issues()
|
||||
|
||||
|
||||
def test_eof_newline():
|
||||
def assert_issue(code):
|
||||
found = issues(code)
|
||||
assert len(found) == 1
|
||||
issue, = found
|
||||
assert issue.code == 292
|
||||
|
||||
assert not issues('asdf = 1\n')
|
||||
assert_issue('asdf = 1')
|
||||
assert_issue('asdf = 1\n#')
|
||||
assert_issue('# foobar')
|
||||
assert_issue('')
|
||||
Reference in New Issue
Block a user