Skip to content

Commit

Permalink
chore: update test snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Dec 5, 2024
1 parent 8f57e92 commit b8cd487
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
with (
make_context_manager1() as cm1,
make_context_manager2() as cm2,
make_context_manager3() as cm3,
make_context_manager4() as cm4,
):
pass


with make_context_manager1() as cm1, make_context_manager2(), make_context_manager3() as cm3, make_context_manager4():
with (
make_context_manager1() as cm1,
make_context_manager2(),
make_context_manager3() as cm3,
make_context_manager4(),
):
pass


with new_new_new1() as cm1, new_new_new2():
pass


with mock.patch.object(
self.my_runner, "first_method", autospec=True
) as mock_run_adb, mock.patch.object(
self.my_runner, "second_method", autospec=True, return_value="foo"
with (
mock.patch.object(self.my_runner, "first_method", autospec=True) as mock_run_adb,
mock.patch.object(
self.my_runner, "second_method", autospec=True, return_value="foo"
),
):
pass
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
with (
make_context_manager1() as cm1,
make_context_manager2() as cm2,
make_context_manager3() as cm3,
make_context_manager4() as cm4,
):
pass


# Leading comment
with make_context_manager1() as cm1, make_context_manager2(), make_context_manager3() as cm3, make_context_manager4():
with (
make_context_manager1() as cm1,
make_context_manager2(),
make_context_manager3() as cm3,
make_context_manager4(),
):
pass


Expand All @@ -26,21 +36,25 @@ with (
pass


with this_is_a_very_long_call(
looong_arg1=looong_value1, looong_arg2=looong_value2
) as cm1, this_is_a_very_long_call(
looong_arg1=looong_value1,
looong_arg2=looong_value2,
looong_arg3=looong_value3,
looong_arg4=looong_value4,
) as cm2:
with (
this_is_a_very_long_call(
looong_arg1=looong_value1, looong_arg2=looong_value2
) as cm1,
this_is_a_very_long_call(
looong_arg1=looong_value1,
looong_arg2=looong_value2,
looong_arg3=looong_value3,
looong_arg4=looong_value4,
) as cm2,
):
pass


with mock.patch.object(
self.my_runner, "first_method", autospec=True
) as mock_run_adb, mock.patch.object(
self.my_runner, "second_method", autospec=True, return_value="foo"
with (
mock.patch.object(self.my_runner, "first_method", autospec=True) as mock_run_adb,
mock.patch.object(
self.my_runner, "second_method", autospec=True, return_value="foo"
),
):
pass

Expand All @@ -56,10 +70,16 @@ with xxxxxxxx.some_kind_of_method(


async def func():
async with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
async with (
make_context_manager1() as cm1,
make_context_manager2() as cm2,
make_context_manager3() as cm3,
make_context_manager4() as cm4,
):
pass

async with some_function(
argument1, argument2, argument3="some_value"
) as some_cm, some_other_function(argument1, argument2, argument3="some_value"):
async with (
some_function(argument1, argument2, argument3="some_value") as some_cm,
some_other_function(argument1, argument2, argument3="some_value"),
):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ match http_code:
print("Not found")


with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
with (
make_context_manager1() as cm1,
make_context_manager2() as cm2,
make_context_manager3() as cm3,
make_context_manager4() as cm4,
):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ except* Error as e:
pass


with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
with (
make_context_manager1() as cm1,
make_context_manager2() as cm2,
make_context_manager3() as cm3,
make_context_manager4() as cm4,
):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ with a:
pass


with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
with (
make_context_manager1() as cm1,
make_context_manager2() as cm2,
make_context_manager3() as cm3,
make_context_manager4() as cm4,
):
pass


with mock.patch.object(
self.my_runner, "first_method", autospec=True
) as mock_run_adb, mock.patch.object(
self.my_runner, "second_method", autospec=True, return_value="foo"
with (
mock.patch.object(self.my_runner, "first_method", autospec=True) as mock_run_adb,
mock.patch.object(
self.my_runner, "second_method", autospec=True, return_value="foo"
),
):
pass
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# This file uses parenthesized context managers introduced in Python 3.9.


with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
with (
make_context_manager1() as cm1,
make_context_manager2() as cm2,
make_context_manager3() as cm3,
make_context_manager4() as cm4,
):
pass


Expand Down
125 changes: 82 additions & 43 deletions crates/ruff_fmt/test_data/ruff/statement/with.py.expect
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
with aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
with (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
):
pass
# trailing

Expand Down Expand Up @@ -49,7 +52,9 @@ with (
with a: # should remove brackets
pass

with aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as c:
with (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as c
):
pass


Expand Down Expand Up @@ -77,22 +82,26 @@ with (
):
pass

with a as (
# leading comment
b
with (
a as (
# leading comment
b
)
):
pass

with a as (
b
# trailing comment
with (
a as (
b
# trailing comment
)
):
pass

with (
a # trailing same line comment
a as b # trailing same line comment
# trailing own line comment
) as b:
):
pass

with (
Expand Down Expand Up @@ -162,12 +171,19 @@ with (
):
pass

with [
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbb",
"cccccccccccccccccccccccccccccccccccccccccc",
dddddddddddddddddddddddddddddddd,
] as example1, aaaaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccccccc + ddddddddddddddddd as example2, CtxManager222222222222222() as example2:
with (
[
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbb",
"cccccccccccccccccccccccccccccccccccccccccc",
dddddddddddddddddddddddddddddddd,
] as example1,
aaaaaaaaaaaaaaaaaaaaaaaaaa
* bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
* cccccccccccccccccccccccccccc
+ ddddddddddddddddd as example2,
CtxManager222222222222222() as example2,
):
pass

# Comments on open parentheses
Expand All @@ -192,11 +208,14 @@ with ( # outer comment
) as example:
pass

with ( # outer comment
CtxManager()
) as example, ( # inner comment
CtxManager2()
) as example2:
with (
( # outer comment
CtxManager()
) as example,
( # inner comment
CtxManager2()
) as example2,
):
pass

with ( # outer comment
Expand All @@ -214,21 +233,27 @@ with ( # outer comment
pass

# Breaking of with items.
with test as ( # bar # foo
# test
foo
with (
test as ( # bar # foo
# test
foo
)
):
pass

with test as (
# test
foo
with (
test as (
# test
foo
)
):
pass

with test as ( # bar # foo # baz
# test
foo
with (
test as ( # bar # foo # baz
# test
foo
)
):
pass

Expand All @@ -242,8 +267,10 @@ with (
):
pass

with a as ( # foo
b
with (
a as ( # foo
b
)
):
pass

Expand All @@ -269,22 +296,31 @@ with (
):
pass

with f(
a,
) as b, c as d:
with (
f(
a,
) as b,
c as d,
):
pass

with (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
) as b:
pass

with aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as b:
with (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as b
):
pass

with (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
) as b, c as d:
(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
) as b,
c as d,
):
pass

with (
Expand Down Expand Up @@ -322,13 +358,16 @@ if True:
pass

if True:
with anyio.CancelScope(
shield=True
) if get_running_loop() else contextlib.nullcontext():
with (
anyio.CancelScope(shield=True)
if get_running_loop()
else contextlib.nullcontext()
):
pass


with Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc), Document(
aaaaa, bbbbbbbbbb, ddddddddddddd
with (
Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc),
Document(aaaaa, bbbbbbbbbb, ddddddddddddd),
):
pass
Loading

0 comments on commit b8cd487

Please sign in to comment.