mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
Format if
statements (#4961)
This commit is contained in:
parent
548a3cbb3f
commit
1accbeffd6
26 changed files with 882 additions and 357 deletions
37
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/if_statement.py
vendored
Normal file
37
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/if_statement.py
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
if x == y: # trailing if condition
|
||||
pass # trailing `pass` comment
|
||||
# Root `if` trailing comment
|
||||
|
||||
# Leading elif comment
|
||||
elif x < y: # trailing elif condition
|
||||
pass
|
||||
# `elif` trailing comment
|
||||
|
||||
# Leading else comment
|
||||
else: # trailing else condition
|
||||
pass
|
||||
# `else` trailing comment
|
||||
|
||||
|
||||
if x == y:
|
||||
if y == z:
|
||||
...
|
||||
|
||||
if a == b:
|
||||
...
|
||||
else: # trailing comment
|
||||
...
|
||||
|
||||
# trailing else comment
|
||||
|
||||
# leading else if comment
|
||||
elif aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + [
|
||||
11111111111111111111111111,
|
||||
2222222222222222222222,
|
||||
3333333333
|
||||
]:
|
||||
...
|
||||
|
||||
|
||||
else:
|
||||
...
|
Loading…
Add table
Add a link
Reference in a new issue