mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
Format expr generator exp (#5804)
This commit is contained in:
parent
cda90d071c
commit
5d68ad9008
13 changed files with 224 additions and 271 deletions
27
crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/generator_exp.py
vendored
Normal file
27
crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/generator_exp.py
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
(a for b in c)
|
||||
|
||||
# parens around generator expression not required
|
||||
len(a for b in c)
|
||||
|
||||
# parens around generator expression required
|
||||
sum((a for b in c), start=0)
|
||||
|
||||
# black keeps these atm, but intends to remove them in the future:
|
||||
# https://github.com/psf/black/issues/2943
|
||||
f((1 for _ in a))
|
||||
|
||||
# make sure source parenthesis detection isn't fooled by these
|
||||
f((1) for _ in (a))
|
||||
|
||||
# combination of the two above
|
||||
f(((1) for _ in (a)))
|
||||
|
||||
|
||||
# black keeps these atm, but intends to remove them in the future:
|
||||
# https://github.com/psf/black/issues/2943
|
||||
len(
|
||||
( # leading
|
||||
a for b in c
|
||||
# trailing
|
||||
)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue