mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-30 15:17:59 +00:00
Add new with
and match
sequence test cases (#9128)
## Summary Add new test cases for `with_item` and `match` sequence that demonstrate how long headers break. Removes one use of `optional_parentheses` in a position where it is know that the parentheses always need to be added. ## Test Plan cargo test
This commit is contained in:
parent
25b2361411
commit
c8d6958d15
5 changed files with 34 additions and 5 deletions
|
@ -584,6 +584,11 @@ match n % 3, n % 5:
|
|||
print("Buzz")
|
||||
case _:
|
||||
print(n)
|
||||
|
||||
# Unparenthesized tuples
|
||||
match x:
|
||||
case Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc), Doc(aaaaa, bbbbbbbbbb, ddddddddddddd):
|
||||
pass
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -1210,6 +1215,13 @@ match n % 3, n % 5:
|
|||
print("Buzz")
|
||||
case _:
|
||||
print(n)
|
||||
|
||||
# Unparenthesized tuples
|
||||
match x:
|
||||
case Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc), Doc(
|
||||
aaaaa, bbbbbbbbbb, ddddddddddddd
|
||||
):
|
||||
pass
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -309,6 +309,10 @@ if True:
|
|||
if True:
|
||||
with anyio.CancelScope(shield=True) if get_running_loop() else contextlib.nullcontext():
|
||||
pass
|
||||
|
||||
|
||||
with Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc), Document(aaaaa, bbbbbbbbbb, ddddddddddddd):
|
||||
pass
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -640,6 +644,12 @@ if True:
|
|||
shield=True
|
||||
) if get_running_loop() else contextlib.nullcontext():
|
||||
pass
|
||||
|
||||
|
||||
with Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc), Document(
|
||||
aaaaa, bbbbbbbbbb, ddddddddddddd
|
||||
):
|
||||
pass
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue