mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:33:50 +00:00
Format DictComp
expression (#5771)
## Summary Format `DictComp` like `ListComp` from #5600. It's not 100%, but I figured maybe it's worth starting to explore. ## Test Plan Added ruff fixture based on `ListComp`'s.
This commit is contained in:
parent
3cda89ecaf
commit
fa4855e6fe
6 changed files with 247 additions and 109 deletions
45
crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/dict_comp.py
vendored
Normal file
45
crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/dict_comp.py
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{i: i for i in []}
|
||||
|
||||
{i: i for i in [1,]}
|
||||
|
||||
{
|
||||
a: a # a
|
||||
for # for
|
||||
c # c
|
||||
in # in
|
||||
e # e
|
||||
}
|
||||
|
||||
{
|
||||
# above a
|
||||
a: a # a
|
||||
# above for
|
||||
for # for
|
||||
# above c
|
||||
c # c
|
||||
# above in
|
||||
in # in
|
||||
# above e
|
||||
e # e
|
||||
# above if
|
||||
if # if
|
||||
# above f
|
||||
f # f
|
||||
# above if2
|
||||
if # if2
|
||||
# above g
|
||||
g # g
|
||||
}
|
||||
|
||||
{
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + [dddddddddddddddddd, eeeeeeeeeeeeeeeeeee]: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
for
|
||||
ccccccccccccccccccccccccccccccccccccccc,
|
||||
ddddddddddddddddddd, [eeeeeeeeeeeeeeeeeeeeee, fffffffffffffffffffffffff]
|
||||
in
|
||||
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffggggggggggggggggggggghhhhhhhhhhhhhhothermoreeand_even_moreddddddddddddddddddddd
|
||||
if
|
||||
fffffffffffffffffffffffffffffffffffffffffff < gggggggggggggggggggggggggggggggggggggggggggggg < hhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
if
|
||||
gggggggggggggggggggggggggggggggggggggggggggg
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue