mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-03 10:04:22 +08:00
Implement E101. No mixing of tabs and spaces in indentation.
This commit is contained in:
44
test/normalizer_issue_files/E10.py
Normal file
44
test/normalizer_issue_files/E10.py
Normal file
@@ -0,0 +1,44 @@
|
||||
for a in 'abc':
|
||||
for b in 'xyz':
|
||||
print a # indented with 8 spaces
|
||||
#: W101:0
|
||||
print b # indented with 1 tab
|
||||
if True:
|
||||
#: W101:0
|
||||
pass
|
||||
|
||||
change_2_log = \
|
||||
"""Change 2 by slamb@testclient on 2006/04/13 21:46:23
|
||||
|
||||
creation
|
||||
"""
|
||||
|
||||
p4change = {
|
||||
2: change_2_log,
|
||||
}
|
||||
|
||||
|
||||
class TestP4Poller(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.setUpGetProcessOutput()
|
||||
return self.setUpChangeSource()
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
#
|
||||
if True:
|
||||
#: E101:0
|
||||
foo(1,
|
||||
2)
|
||||
|
||||
def test_keys(self):
|
||||
"""areas.json - All regions are accounted for."""
|
||||
expected = set([
|
||||
u'Norrbotten',
|
||||
u'V\xe4sterbotten',
|
||||
])
|
||||
if True:
|
||||
print("""
|
||||
tab at start of this line
|
||||
""")
|
||||
@@ -20,7 +20,7 @@ def collect_errors(code):
|
||||
code, _, add_indent = code.partition(':')
|
||||
column = int(add_indent)
|
||||
|
||||
yield "%s@(%s,%s)" % (code, line_nr + 1, column)
|
||||
yield "%s@(%s,%s)" % (code[1:], line_nr + 1, column)
|
||||
|
||||
|
||||
def test_normalizer_issue(normalizer_issue_file):
|
||||
@@ -32,7 +32,7 @@ def test_normalizer_issue(normalizer_issue_file):
|
||||
module = parso.parse(code)
|
||||
issues = module._get_normalizer_issues()
|
||||
|
||||
i = set("E%s@(%s,%s)" % (i.code, i.start_pos[0], i.start_pos[1]) for i in issues)
|
||||
i = set("%s@(%s,%s)" % (i.code, i.start_pos[0], i.start_pos[1]) for i in issues)
|
||||
d = set(desired)
|
||||
assert i == d, dedent("""
|
||||
Test %r failed (%s of %s passed).
|
||||
|
||||
Reference in New Issue
Block a user