-
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.
Add test case for docstring with comments
- Loading branch information
1 parent
e95adb9
commit 779413d
Showing
3 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...hon_formatter/resources/test/fixtures/ruff/blank_line_before_class_docstring.options.json
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,5 @@ | ||
[ | ||
{ | ||
"preview": "enabled" | ||
} | ||
] |
38 changes: 38 additions & 0 deletions
38
...s/ruff_python_formatter/resources/test/fixtures/ruff/blank_line_before_class_docstring.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,38 @@ | ||
class NormalDocstring: | ||
|
||
"""This is a docstring.""" | ||
|
||
|
||
class DocstringWithComment0: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
|
||
|
||
class DocstringWithComment1: | ||
# This is a comment | ||
|
||
"""This is a docstring.""" | ||
|
||
|
||
class DocstringWithComment2: | ||
|
||
# This is a comment | ||
"""This is a docstring.""" | ||
|
||
|
||
class DocstringWithComment3: | ||
|
||
# This is a comment | ||
|
||
"""This is a docstring.""" | ||
|
||
|
||
class DocstringWithComment4: | ||
|
||
|
||
# This is a comment | ||
|
||
|
||
"""This is a docstring.""" | ||
|
||
|
95 changes: 95 additions & 0 deletions
95
...es/ruff_python_formatter/tests/snapshots/format@blank_line_before_class_docstring.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,95 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/blank_line_before_class_docstring.py | ||
--- | ||
## Input | ||
```python | ||
class NormalDocstring: | ||
"""This is a docstring.""" | ||
class DocstringWithComment0: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment1: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment2: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment3: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment4: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
``` | ||
|
||
## Outputs | ||
### Output 1 | ||
``` | ||
indent-style = space | ||
line-width = 88 | ||
indent-width = 4 | ||
quote-style = Double | ||
line-ending = LineFeed | ||
magic-trailing-comma = Respect | ||
docstring-code = Disabled | ||
docstring-code-line-width = "dynamic" | ||
preview = Enabled | ||
``` | ||
|
||
```python | ||
class NormalDocstring: | ||
"""This is a docstring.""" | ||
class DocstringWithComment0: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment1: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment2: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment3: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
class DocstringWithComment4: | ||
# This is a comment | ||
"""This is a docstring.""" | ||
``` | ||
|
||
|
||
|