Format expr generator exp (#5804)

This commit is contained in:
David Szotten 2023-07-19 12:01:58 +01:00 committed by GitHub
parent cda90d071c
commit 5d68ad9008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 224 additions and 271 deletions

View 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
)
)