mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 04:48:07 +00:00
ruff_python_formatter: add test for extraneous info string text (#9050)
@ofek asked [about this][ref]. I did specifically add support for it, but neglected to add a test. This PR adds a test. [ref]: https://github.com/astral-sh/ruff/pull/9030#issuecomment-1846054764
This commit is contained in:
parent
2414298289
commit
a224f19903
2 changed files with 140 additions and 0 deletions
|
|
@ -1195,6 +1195,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff( 1 )
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
|
||||||
|
|
@ -1201,6 +1201,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff( 1 )
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -2556,6 +2570,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff( 1 )
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -3911,6 +3939,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff( 1 )
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -5266,6 +5308,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff( 1 )
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -6621,6 +6677,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff( 1 )
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -7971,6 +8041,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff(1)
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -9321,6 +9405,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff(1)
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -10671,6 +10769,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff(1)
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
@ -12021,6 +12133,20 @@ def markdown_over_indented():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# This tests that we can have additional text after the language specifier.
|
||||||
|
def markdown_additional_info_string():
|
||||||
|
"""
|
||||||
|
Do cool stuff.
|
||||||
|
|
||||||
|
```python tab="plugin.py"
|
||||||
|
cool_stuff(1)
|
||||||
|
```
|
||||||
|
|
||||||
|
Done.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Tests that an unclosed block gobbles up everything remaining in the
|
# Tests that an unclosed block gobbles up everything remaining in the
|
||||||
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
# docstring, even if it isn't valid Python. Since it isn't valid Python,
|
||||||
# reformatting fails and the entire thing is skipped.
|
# reformatting fails and the entire thing is skipped.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue