-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't trim last empty line in docstrings (#9813)
- Loading branch information
1 parent
55d0e11
commit 80fc02e
Showing
3 changed files
with
186 additions
and
2 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_newlines.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Tests that Ruff correctly preserves newlines before the closing quote | ||
|
||
def test(): | ||
"""a, b | ||
c""" | ||
|
||
|
||
def test2(): | ||
"""a, b | ||
c | ||
""" | ||
|
||
def test3(): | ||
"""a, b | ||
""" | ||
|
||
|
||
def test4(): | ||
""" | ||
a, b | ||
""" | ||
|
||
|
||
def test5(): | ||
""" | ||
a, b | ||
a""" | ||
|
||
def test6(): | ||
""" | ||
a, b | ||
c | ||
""" | ||
|
||
|
||
|
||
def test7(): | ||
""" | ||
a, b | ||
""" | ||
|
||
def test7(): | ||
""" | ||
a, b | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
crates/ruff_python_formatter/tests/snapshots/format@docstring_newlines.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_newlines.py | ||
--- | ||
## Input | ||
```python | ||
# Tests that Ruff correctly preserves newlines before the closing quote | ||
def test(): | ||
"""a, b | ||
c""" | ||
def test2(): | ||
"""a, b | ||
c | ||
""" | ||
def test3(): | ||
"""a, b | ||
""" | ||
def test4(): | ||
""" | ||
a, b | ||
""" | ||
def test5(): | ||
""" | ||
a, b | ||
a""" | ||
def test6(): | ||
""" | ||
a, b | ||
c | ||
""" | ||
def test7(): | ||
""" | ||
a, b | ||
""" | ||
def test7(): | ||
""" | ||
a, b | ||
""" | ||
``` | ||
|
||
## Output | ||
```python | ||
# Tests that Ruff correctly preserves newlines before the closing quote | ||
def test(): | ||
"""a, b | ||
c""" | ||
def test2(): | ||
"""a, b | ||
c | ||
""" | ||
def test3(): | ||
"""a, b""" | ||
def test4(): | ||
""" | ||
a, b | ||
""" | ||
def test5(): | ||
""" | ||
a, b | ||
a""" | ||
def test6(): | ||
""" | ||
a, b | ||
c | ||
""" | ||
def test7(): | ||
""" | ||
a, b | ||
""" | ||
def test7(): | ||
""" | ||
a, b | ||
""" | ||
``` | ||
|
||
|
||
|