From b924cd69459a8c7615b398bf824acf6b1ed88c5d Mon Sep 17 00:00:00 2001 From: dylwil3 Date: Mon, 8 Dec 2025 12:42:51 -0600 Subject: [PATCH] snapshots --- ...ty@cases__preview_long_dict_values.py.snap | 12 ++- ...y@cases__preview_multiline_strings.py.snap | 8 +- ...g_code_examples_dynamic_line_width.py.snap | 13 +++ .../format@expression__attribute.py.snap | 17 ++++ ...t@expression__split_empty_brackets.py.snap | 20 ++++- .../format@parentheses__call_chains.py.snap | 84 ++++++++++++++++--- 6 files changed, 131 insertions(+), 23 deletions(-) diff --git a/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_long_dict_values.py.snap b/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_long_dict_values.py.snap index f021bad61c..5efb50eefa 100644 --- a/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_long_dict_values.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_long_dict_values.py.snap @@ -228,7 +228,7 @@ class Random: } { -@@ -139,17 +133,17 @@ +@@ -139,17 +133,16 @@ class Random: def func(): @@ -244,9 +244,8 @@ class Random: - "actionTimestamp": ( - Timestamp(seconds=1530584000, nanos=0).ToJsonString() - ), -+ "actionTimestamp": Timestamp( -+ seconds=1530584000, nanos=0 -+ ).ToJsonString(), ++ "actionTimestamp": Timestamp(seconds=1530584000, nanos=0) ++ .ToJsonString(), } }, - } @@ -399,9 +398,8 @@ class Random: "timestamp": 1234, "latitude": 1, "longitude": 2, - "actionTimestamp": Timestamp( - seconds=1530584000, nanos=0 - ).ToJsonString(), + "actionTimestamp": Timestamp(seconds=1530584000, nanos=0) + .ToJsonString(), } }, }) diff --git a/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_multiline_strings.py.snap b/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_multiline_strings.py.snap index 29af6e1b07..5507caf173 100644 --- a/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_multiline_strings.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__preview_multiline_strings.py.snap @@ -414,12 +414,12 @@ a = b if """ + """cow +moos""" +} -+[ -+ """cow -+moos""" -+] [ """cow ++moos""" ++] ++[ ++ """cow moos""", @@ -206,7 +245,9 @@ "c" diff --git a/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples_dynamic_line_width.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples_dynamic_line_width.py.snap index 628910f153..14a2a4289c 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples_dynamic_line_width.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples_dynamic_line_width.py.snap @@ -2914,6 +2914,19 @@ def length_rst_in_section(): ```diff --- Stable +++ Preview +@@ -683,9 +683,9 @@ + ... self._df.filter(pl.col(col).str.starts_with(c)) + ... for c in sorted( + ... set( +- ... df.select( +- ... pl.col(col).str.slice(0, 1) +- ... ).to_series() ++ ... df ++ ... .select(pl.col(col).str.slice(0, 1)) ++ ... .to_series() + ... ) + ... ) + ... ] @@ -700,9 +700,11 @@ Examples diff --git a/crates/ruff_python_formatter/tests/snapshots/format@expression__attribute.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@expression__attribute.py.snap index 4677ca06de..d7eb98968f 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@expression__attribute.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@expression__attribute.py.snap @@ -429,3 +429,20 @@ variable = ( .first_method("some string") ) ``` + + +## Preview changes +```diff +--- Stable ++++ Preview +@@ -171,7 +171,8 @@ + if ( + ( + something # a comment +- ).first_method("some string") # second comment ++ ) ++ .first_method("some string") # second comment + ): + pass + +``` diff --git a/crates/ruff_python_formatter/tests/snapshots/format@expression__split_empty_brackets.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@expression__split_empty_brackets.py.snap index 65fa97cca4..2f8c9f503e 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@expression__split_empty_brackets.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@expression__split_empty_brackets.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_formatter/tests/fixtures.rs input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/split_empty_brackets.py -snapshot_kind: text --- ## Input ```python @@ -199,7 +198,24 @@ response = await sync_to_async( ```diff --- Stable +++ Preview -@@ -62,9 +62,9 @@ +@@ -18,10 +18,14 @@ + ).casefold(1) + + ct_match = ( +- unicodedata.normalize("NFKC", s1).casefold( ++ unicodedata ++ .normalize("NFKC", s1) ++ .casefold( + # foo + ) +- == unicodedata.normalize("NFKCNFKCNFKCNFKCNFKC", s2).casefold( ++ == unicodedata ++ .normalize("NFKCNFKCNFKCNFKCNFKC", s2) ++ .casefold( + # foo + ) + ) +@@ -62,9 +66,9 @@ 1 }.unicodedata.normalize("NFKCNFKCNFKCNFKCNFKC", s2).casefold() diff --git a/crates/ruff_python_formatter/tests/snapshots/format@parentheses__call_chains.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@parentheses__call_chains.py.snap index 8cfc5fbd1a..aa50015b27 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@parentheses__call_chains.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@parentheses__call_chains.py.snap @@ -472,7 +472,26 @@ max_message_id = ( ```diff --- Stable +++ Preview -@@ -21,7 +21,8 @@ +@@ -4,11 +4,13 @@ + aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa + ).a(aaaa) + +-raise OsError( +- "sökdjffffsldkfjlhsakfjhalsökafhsöfdahsödfjösaaksjdllllllllllllll" +-) from a.aaaaa( +- aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa +-).a(aaaa) ++raise OsError("sökdjffffsldkfjlhsakfjhalsökafhsöfdahsödfjösaaksjdllllllllllllll") from ( ++ a ++ .aaaaa( ++ aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa ++ ) ++ .a(aaaa) ++) + + a1 = Blog.objects.filter(entry__headline__contains="Lennon").filter( + entry__pub_date__year=2008 +@@ -21,7 +23,8 @@ ) raise OsError("") from ( @@ -482,7 +501,7 @@ max_message_id = ( entry__headline__contains="Lennon", ) .filter( -@@ -33,7 +34,8 @@ +@@ -33,7 +36,8 @@ ) raise OsError("sökdjffffsldkfjlhsakfjhalsökafhsöfdahsödfjösaaksjdllllllllllllll") from ( @@ -492,7 +511,7 @@ max_message_id = ( entry__headline__contains="Lennon", ) .filter( -@@ -46,7 +48,8 @@ +@@ -46,7 +50,8 @@ # Break only after calls and indexing b1 = ( @@ -502,7 +521,7 @@ max_message_id = ( .filter( models.Customer.account_id == account_id, models.Customer.email == email_address ) -@@ -54,7 +57,8 @@ +@@ -54,7 +59,8 @@ ) b2 = ( @@ -512,8 +531,17 @@ max_message_id = ( entry__headline__contains="Lennon", ) .limit_results[:10] -@@ -70,7 +74,8 @@ - ).filter( +@@ -65,12 +71,15 @@ + + # Nested call chains + c1 = ( +- Blog.objects.filter( ++ Blog.objects ++ .filter( + entry__headline__contains="Lennon", +- ).filter( ++ ) ++ .filter( entry__pub_date__year=2008, ) - + Blog.objects.filter( @@ -522,7 +550,7 @@ max_message_id = ( entry__headline__contains="McCartney", ) .limit_results[:10] -@@ -89,7 +94,8 @@ +@@ -89,19 +98,23 @@ d11 = x.e().e().e() # d12 = x.e().e().e() # d13 = ( @@ -532,7 +560,14 @@ max_message_id = ( .e() .e() ) -@@ -101,7 +107,8 @@ + + # Doesn't fit, default + d2 = ( +- x.e().esadjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkfsdddd() # ++ x ++ .e() ++ .esadjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkfsdddd() # + ) # Doesn't fit, fluent style d3 = ( @@ -542,7 +577,32 @@ max_message_id = ( .esadjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk() .esadjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk() ) -@@ -218,7 +225,8 @@ +@@ -199,16 +212,21 @@ + + ( + ( +- df1_aaaaaaaaaaaa.merge().groupby( ++ df1_aaaaaaaaaaaa ++ .merge() ++ .groupby( + 1, + ) +- ).sum() ++ ) ++ .sum() + ) + + + ( + ( +- df1_aaaaaaaaaaaa.merge().groupby( ++ df1_aaaaaaaaaaaa ++ .merge() ++ .groupby( + 1, + ) + ) +@@ -218,17 +236,20 @@ ( ( @@ -552,7 +612,11 @@ max_message_id = ( .groupby( 1, ) -@@ -228,7 +236,8 @@ + .bar() +- ).sum() ++ ) ++ .sum() + ) ( (