Fix formatter with-statement after-as own line comment instability (#6033)

**Summary** Fix an instability in with statement formatter when there is
an own line comment as the `as`
```python
with (
    a as
    # bad comment
    b):
```

**Test Plan** Added the comment to the test cases.
This commit is contained in:
konsti 2023-07-24 20:12:07 +02:00 committed by GitHub
parent a9f535997d
commit 7f3797185c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 11 deletions

View file

@ -31,6 +31,7 @@ with (
with (
a # a
as # as
# own line
b # b
, # comma
c # c
@ -38,6 +39,13 @@ with (
... # body
# body trailing own
with (
a # a
as # as
# own line
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb # b
): pass
with (a,): # magic trailing comma
...
@ -142,12 +150,21 @@ with (
with (
a as b, # a # as # b # comma
a as # a # as
# own line
b, # b # comma
c, # c
): # colon
... # body
# body trailing own
with (
a as # a # as
# own line
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb # b
):
pass
with (
a,