mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-09 21:12:42 +08:00
Get the indentation errors of files mostly right even in comments.
This commit is contained in:
52
test/normalizer_issue_files/E11.py
Normal file
52
test/normalizer_issue_files/E11.py
Normal file
@@ -0,0 +1,52 @@
|
||||
if x > 2:
|
||||
#: E111:2
|
||||
print x
|
||||
if True:
|
||||
#: E111:5
|
||||
print
|
||||
#: E116:6
|
||||
#
|
||||
#: E116:2
|
||||
# what
|
||||
# Comment is fine
|
||||
# Comment is also fine
|
||||
|
||||
if False:
|
||||
print
|
||||
print
|
||||
print
|
||||
mimetype = 'application/x-directory'
|
||||
#: E116:5
|
||||
# 'httpd/unix-directory'
|
||||
create_date = False
|
||||
|
||||
def start(self):
|
||||
if True: # Hello
|
||||
self.master.start() # Comment
|
||||
# try:
|
||||
#: E116:12
|
||||
# self.master.start()
|
||||
# except MasterExit:
|
||||
#: E116:12
|
||||
# self.shutdown()
|
||||
# finally:
|
||||
#: E116:12
|
||||
# sys.exit()
|
||||
# Dedent to the first level
|
||||
#: E116:6
|
||||
# error
|
||||
# Dedent to the base level
|
||||
#: E116:2
|
||||
# Also wrongly indented.
|
||||
# Indent is correct.
|
||||
def start(self): # Correct comment
|
||||
if True:
|
||||
#: E115:0
|
||||
# try:
|
||||
#: E115:0
|
||||
# self.master.start()
|
||||
#: E115:0
|
||||
# except MasterExit:
|
||||
#: E115:0
|
||||
# self.shutdown()
|
||||
self.master.start() # comment
|
||||
@@ -1,7 +1,7 @@
|
||||
#: E721
|
||||
#: E721:3
|
||||
if type(res) == type(42):
|
||||
pass
|
||||
#: E721
|
||||
#: E721:3
|
||||
if type(res) != type(""):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user