Skip to content

Commit

Permalink
Add test case for docstring with comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed Dec 19, 2023
1 parent e95adb9 commit 779413d
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
"preview": "enabled"
}
]
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."""


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."""
```



0 comments on commit 779413d

Please sign in to comment.