Skip to content

Commit be43039

Browse files
committed
snapshot changes
1 parent 2cd732f commit be43039

7 files changed

Lines changed: 48 additions & 205 deletions

‎crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__allow_empty_first_line.py.snap‎

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/ruff_python_formatter/tests/fixtures.rs
3-
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/allow_empty_first_line.py
43
---
54
## Input
65

@@ -102,7 +101,7 @@ def top_level(
102101
# This is also now fine
103102
a = 123
104103
105-
@@ -14,52 +13,41 @@
104+
@@ -14,26 +13,20 @@
106105
a = 123
107106
108107
if y:
@@ -129,38 +128,13 @@ def top_level(
129128
"""also this"""
130129
a = 123
131130
132-
133-
def bar():
134-
-
135-
if x:
136-
a = 123
137-
138-
139-
def baz():
140-
-
141-
# OK
142-
if x:
143-
a = 123
144-
145-
146-
def quux():
147-
-
148-
new_line = here
131+
@@ -57,7 +50,6 @@
149132
150133
151134
class Cls:
152135
-
153136
def method(self):
154-
-
155-
pass
156137
157-
158-
@@ -76,6 +64,5 @@
159-
a: int,
160-
b: str,
161-
) -> Whatever[Generic, Something]:
162-
-
163-
def nested(x: int) -> int:
164138
pass
165139
```
166140

@@ -201,22 +175,26 @@ def foo():
201175
202176
203177
def bar():
178+
204179
if x:
205180
a = 123
206181
207182
208183
def baz():
184+
209185
# OK
210186
if x:
211187
a = 123
212188
213189
214190
def quux():
191+
215192
new_line = here
216193
217194
218195
class Cls:
219196
def method(self):
197+
220198
pass
221199
222200
@@ -233,6 +211,7 @@ def top_level(
233211
a: int,
234212
b: str,
235213
) -> Whatever[Generic, Something]:
214+
236215
def nested(x: int) -> int:
237216
pass
238217
```

‎crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__dummy_implementations.py.snap‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/ruff_python_formatter/tests/fixtures.rs
3-
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/dummy_implementations.py
43
---
54
## Input
65

@@ -141,20 +140,13 @@ class ClassH:
141140
```diff
142141
--- Black
143142
+++ Ruff
144-
@@ -82,14 +82,12 @@
143+
@@ -106,6 +106,7 @@
145144
146-
class ClassC:
147-
def f(self):
148-
-
149-
...
150-
# Comment
151-
152-
153-
class ClassD:
145+
class ClassG:
154146
def f(self): # Comment 1
155-
-
147+
+
156148
... # Comment 2
157-
# Comment 3
149+
158150
159151
```
160152

@@ -245,12 +237,14 @@ class ClassB:
245237
246238
class ClassC:
247239
def f(self):
240+
248241
...
249242
# Comment
250243
251244
252245
class ClassD:
253246
def f(self): # Comment 1
247+
254248
... # Comment 2
255249
# Comment 3
256250
@@ -267,6 +261,7 @@ class ClassF:
267261
268262
class ClassG:
269263
def f(self): # Comment 1
264+
270265
... # Comment 2
271266
272267

‎crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__form_feeds.py.snap‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/ruff_python_formatter/tests/fixtures.rs
3-
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/form_feeds.py
43
---
54
## Input
65

@@ -149,11 +148,9 @@ a = [
149148
#
150149
151150
-
152-
+
153-
#
151+
-#
154152
155153
-
156-
+
157154
#
158155
159156
-
@@ -164,10 +161,12 @@ a = [
164161
+
165162
#
166163
-
164+
+
167165
+
168166
#
169167
-
170-
-#
168+
+
169+
#
171170
172171
+#
173172
@@ -212,7 +211,7 @@ a = [
212211
pass
213212
214213
215-
@@ -69,25 +68,23 @@
214+
@@ -69,7 +68,7 @@
216215
def foo():
217216
pass
218217
@@ -221,10 +220,7 @@ a = [
221220
pass
222221
223222
224-
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
225-
def bar(a=1, b: bool = False):
226-
-
227-
pass
223+
@@ -80,14 +79,13 @@
228224
229225
230226
class Baz:
@@ -321,6 +317,7 @@ pass
321317
322318
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
323319
def bar(a=1, b: bool = False):
320+
324321
pass
325322
326323

‎crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__keep_newline_after_match.py.snap‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/ruff_python_formatter/tests/fixtures.rs
3-
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/keep_newline_after_match.py
43
---
54
## Input
65

@@ -31,9 +30,9 @@ def http_status(status):
3130
```diff
3231
--- Black
3332
+++ Ruff
34-
@@ -1,19 +1,13 @@
33+
@@ -1,19 +1,14 @@
3534
def http_status(status):
36-
-
35+
3736
match status:
3837
-
3938
case 400:
@@ -57,6 +56,7 @@ def http_status(status):
5756

5857
```python
5958
def http_status(status):
59+
6060
match status:
6161
case 400:
6262
return "Bad request"

‎crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__remove_newline_after_code_block_open.py.snap‎

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/ruff_python_formatter/tests/fixtures.rs
3-
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/remove_newline_after_code_block_open.py
43
---
54
## Input
65

@@ -122,37 +121,7 @@ with open("/path/to/file.txt", mode="r") as read_file:
122121
```diff
123122
--- Black
124123
+++ Ruff
125-
@@ -2,24 +2,20 @@
126-
127-
128-
def foo1():
129-
-
130-
print("The newline above me should be kept!")
131-
132-
133-
def foo2():
134-
-
135-
print("All the newlines above me should be kept!")
136-
137-
138-
def foo3():
139-
-
140-
print("No newline above me!")
141-
142-
print("There is a newline above me, and that's OK!")
143-
144-
145-
def foo4():
146-
-
147-
# There is a comment here
148-
149-
print("The newline above me should not be deleted!")
150-
@@ -27,73 +23,56 @@
151-
152-
class Foo:
153-
def bar(self):
154-
-
155-
print("The newline above me should be kept!")
124+
@@ -32,68 +32,52 @@
156125
157126
158127
for i in range(5):
@@ -230,27 +199,32 @@ import random
230199
231200
232201
def foo1():
202+
233203
print("The newline above me should be kept!")
234204
235205
236206
def foo2():
207+
237208
print("All the newlines above me should be kept!")
238209
239210
240211
def foo3():
212+
241213
print("No newline above me!")
242214
243215
print("There is a newline above me, and that's OK!")
244216
245217
246218
def foo4():
219+
247220
# There is a comment here
248221
249222
print("The newline above me should not be deleted!")
250223
251224
252225
class Foo:
253226
def bar(self):
227+
254228
print("The newline above me should be kept!")
255229
256230

0 commit comments

Comments
 (0)