You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__pattern_matching_with_if_stmt.py.snap
+16-45
Original file line number
Diff line number
Diff line change
@@ -44,36 +44,9 @@ match x:
44
44
```diff
45
45
--- Black
46
46
+++ Ruff
47
-
@@ -3,34 +3,36 @@
47
+
@@ -21,11 +21,17 @@
48
48
pass
49
-
50
-
match smth:
51
-
- case "test" if (
52
-
- "any long condition" != "another long condition" and "this is a long condition"
53
-
- ):
54
-
+ case "test" if "any long condition" != "another long condition" and "this is a long condition":
55
-
pass
56
-
- case test if (
57
-
- "any long condition" != "another long condition"
58
-
- and "this is a looooong condition"
59
-
- ):
60
-
+ case (
61
-
+ test
62
-
+ ) if "any long condition" != "another long condition" and "this is a looooong condition":
63
-
pass
64
-
- case test if (
65
-
- "any long condition" != "another long condition"
66
-
- and "this is a looooong condition"
67
-
- ): # some additional comments
68
-
+ case (
69
-
+ test
70
-
+ ) if "any long condition" != "another long condition" and "this is a looooong condition": # some additional comments
71
-
pass
72
-
- case test if True: # some comment
73
-
+ case test if (True): # some comment
74
-
pass
75
-
- case test if False: # some comment
76
-
+ case test if (False): # some comment
49
+
case test if False: # some comment
77
50
pass
78
51
- case test if True: # some comment
79
52
+ case test if (
@@ -92,12 +65,6 @@ match x:
92
65
pass # some comment
93
66
94
67
# case black_test_patma_052 (originally in the pattern_matching_complex test case)
95
-
match x:
96
-
case [1, 0] if x := x[:0]:
97
-
y = 1
98
-
- case [1, 0] if x := x[:0]:
99
-
+ case [1, 0] if (x := x[:0]):
100
-
y = 1
101
68
```
102
69
103
70
## RuffOutput
@@ -108,19 +75,23 @@ match match:
108
75
pass
109
76
110
77
match smth:
111
-
case "test" if "any long condition" != "another long condition" and "this is a long condition":
78
+
case "test" if (
79
+
"any long condition" != "another long condition" and "this is a long condition"
80
+
):
112
81
pass
113
-
case (
114
-
test
115
-
) if "any long condition" != "another long condition" and "this is a looooong condition":
82
+
case test if (
83
+
"any long condition" != "another long condition"
84
+
and "this is a looooong condition"
85
+
):
116
86
pass
117
-
case (
118
-
test
119
-
) if "any long condition" != "another long condition" and "this is a looooong condition": # some additional comments
Copy file name to clipboardExpand all lines: crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__remove_redundant_parens_in_case_guard.py.snap
+6-32
Original file line number
Diff line number
Diff line change
@@ -69,20 +69,7 @@ match 1:
69
69
```diff
70
70
--- Black
71
71
+++ Ruff
72
-
@@ -1,10 +1,10 @@
73
-
match 1:
74
-
- case _ if True:
75
-
+ case _ if (True):
76
-
pass
77
-
78
-
79
-
match 1:
80
-
- case _ if True:
81
-
+ case _ if (True):
82
-
pass
83
-
84
-
85
-
@@ -25,27 +25,33 @@
72
+
@@ -25,12 +25,16 @@
86
73
87
74
88
75
match 1:
@@ -101,18 +88,7 @@ match 1:
101
88
pass
102
89
103
90
104
-
match 1:
105
-
- case _ if True: # this is a comment
106
-
+ case _ if (True): # this is a comment
107
-
pass
108
-
109
-
110
-
match 1:
111
-
- case _ if True: # comment over the line limit unless parens are removed x
112
-
+ case _ if (
113
-
+ True
114
-
+ ): # comment over the line limit unless parens are removed x
115
-
pass
91
+
@@ -45,7 +49,7 @@
116
92
117
93
118
94
match 1:
@@ -129,12 +105,12 @@ match 1:
129
105
130
106
```python
131
107
match 1:
132
-
case _ if (True):
108
+
case _ if True:
133
109
pass
134
110
135
111
136
112
match 1:
137
-
case _ if (True):
113
+
case _ if True:
138
114
pass
139
115
140
116
@@ -169,14 +145,12 @@ match 1:
169
145
170
146
171
147
match 1:
172
-
case _ if (True): # this is a comment
148
+
case _ if True: # this is a comment
173
149
pass
174
150
175
151
176
152
match 1:
177
-
case _ if (
178
-
True
179
-
): # comment over the line limit unless parens are removed x
153
+
case _ if True: # comment over the line limit unless parens are removed x
0 commit comments