Emit non-logical newlines for "empty" lines (#4444)

This commit is contained in:
Charlie Marsh 2023-05-16 10:58:56 -04:00 committed by GitHub
parent 8134ec25f0
commit f0465bf106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 54 additions and 161 deletions

View file

@ -1,62 +0,0 @@
---
source: crates/ruff_python_formatter/src/lib.rs
expression: snapshot
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/comment_after_escaped_newline.py
---
## Input
```py
def bob(): \
# pylint: disable=W9016
pass
def bobtwo(): \
\
# some comment here
pass
```
## Black Differences
```diff
--- Black
+++ Ruff
@@ -1,6 +1,8 @@
-def bob(): # pylint: disable=W9016
+def bob():
+ # pylint: disable=W9016
pass
-def bobtwo(): # some comment here
+def bobtwo():
+ # some comment here
pass
```
## Ruff Output
```py
def bob():
# pylint: disable=W9016
pass
def bobtwo():
# some comment here
pass
```
## Black Output
```py
def bob(): # pylint: disable=W9016
pass
def bobtwo(): # some comment here
pass
```