Don't trim last empty line in docstrings (#9813)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
"""
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user