mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-06 21:04:29 +08:00
138 lines
2.6 KiB
Python
138 lines
2.6 KiB
Python
# Used to be the file for W191
|
|
|
|
#: E101+1
|
|
if False:
|
|
print # indented with 1 tab
|
|
|
|
#: E101+1
|
|
y = x == 2 \
|
|
or x == 3
|
|
#: E101+5
|
|
if (
|
|
x == (
|
|
3
|
|
) or
|
|
y == 4):
|
|
pass
|
|
#: E101+3
|
|
if x == 2 \
|
|
or y > 1 \
|
|
or x == 3:
|
|
pass
|
|
#: E101+3
|
|
if x == 2 \
|
|
or y > 1 \
|
|
or x == 3:
|
|
pass
|
|
|
|
#: E101+1
|
|
if (foo == bar and baz == frop):
|
|
pass
|
|
#: E101+1
|
|
if (foo == bar and baz == frop):
|
|
pass
|
|
|
|
#: E101+2 E101+3
|
|
if start[1] > end_col and not (
|
|
over_indent == 4 and indent_next):
|
|
assert (0, "E121 continuation line over-"
|
|
"indented for visual indent")
|
|
|
|
|
|
#: E101+3
|
|
def long_function_name(
|
|
var_one, var_two, var_three,
|
|
var_four):
|
|
hello(var_one)
|
|
|
|
|
|
#: E101+2
|
|
if ((row < 0 or self.moduleCount <= row or
|
|
col < 0 or self.moduleCount <= col)):
|
|
raise Exception("%s,%s - %s" % (row, col, self.moduleCount))
|
|
#: E101+1 E101+2 E101+3 E101+4 E101+5 E101+6
|
|
if bar:
|
|
assert (
|
|
start, 'E121 lines starting with a '
|
|
'closing bracket should be indented '
|
|
"to match that of the opening "
|
|
"bracket's line"
|
|
)
|
|
|
|
# you want vertical alignment, so use a parens
|
|
#: E101+3
|
|
if ((foo.bar("baz") and
|
|
foo.bar("frop")
|
|
)):
|
|
hello("yes")
|
|
#: E101+3
|
|
# also ok, but starting to look like LISP
|
|
if ((foo.bar("baz") and
|
|
foo.bar("frop"))):
|
|
hello("yes")
|
|
#: E101+1
|
|
if (a == 2 or b == "abc def ghi" "jkl mno"):
|
|
assert True
|
|
#: E101+2
|
|
if (a == 2 or b == """abc def ghi
|
|
jkl mno"""):
|
|
assert True
|
|
#: E101+1 E101+2
|
|
if length > options.max_line_length:
|
|
assert options.max_line_length, \
|
|
"E501 line too long (%d characters)" % length
|
|
|
|
|
|
#: E101+1 E101+2
|
|
if os.path.exists(os.path.join(path, PEP8_BIN)):
|
|
cmd = ([os.path.join(path, PEP8_BIN)] +
|
|
self._pep8_options(targetfile))
|
|
# TODO Tabs in docstrings shouldn't be there, use \t.
|
|
'''
|
|
multiline string with tab in it'''
|
|
# Same here.
|
|
'''multiline string
|
|
with tabs
|
|
and spaces
|
|
'''
|
|
# Okay
|
|
'''sometimes, you just need to go nuts in a multiline string
|
|
and allow all sorts of crap
|
|
like mixed tabs and spaces
|
|
|
|
or trailing whitespace
|
|
or long long long long long long long long long long long long long long long long long lines
|
|
''' # noqa
|
|
# Okay
|
|
'''this one
|
|
will get no warning
|
|
even though the noqa comment is not immediately after the string
|
|
''' + foo # noqa
|
|
|
|
#: E101+2
|
|
if foo is None and bar is "frop" and \
|
|
blah == 'yeah':
|
|
blah = 'yeahnah'
|
|
|
|
|
|
#: E101+1 E101+2 E101+3
|
|
if True:
|
|
foo(
|
|
1,
|
|
2)
|
|
|
|
|
|
#: E101+1 E101+2 E101+3 E101+4 E101+5
|
|
def test_keys(self):
|
|
"""areas.json - All regions are accounted for."""
|
|
expected = set([
|
|
u'Norrbotten',
|
|
u'V\xe4sterbotten',
|
|
])
|
|
|
|
|
|
#: E101+1
|
|
x = [
|
|
'abc'
|
|
]
|