mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:52:01 +00:00
Format while
Statement (#4810)
This commit is contained in:
parent
d1d06960f0
commit
c65f47d7c4
18 changed files with 555 additions and 145 deletions
30
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/while.py
vendored
Normal file
30
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/while.py
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
while 34: # trailing test comment
|
||||
pass # trailing last statement comment
|
||||
|
||||
# trailing while body comment
|
||||
|
||||
# leading else comment
|
||||
|
||||
else: # trailing else comment
|
||||
pass
|
||||
|
||||
# trailing else body comment
|
||||
|
||||
|
||||
while aVeryLongConditionThatSpillsOverToTheNextLineBecauseItIsExtremelyLongAndGoesOnAndOnAndOnAndOnAndOnAndOnAndOnAndOnAndOn: # trailing comment
|
||||
pass
|
||||
|
||||
else:
|
||||
...
|
||||
|
||||
while (
|
||||
some_condition(unformatted, args) and anotherCondition or aThirdCondition
|
||||
): # comment
|
||||
print("Do something")
|
||||
|
||||
|
||||
while (
|
||||
some_condition(unformatted, args) # trailing some condition
|
||||
and anotherCondition or aThirdCondition # trailing third condition
|
||||
): # comment
|
||||
print("Do something")
|
Loading…
Add table
Add a link
Reference in a new issue