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:
Andrew Gallant 2023-12-07 19:52:14 -05:00 committed by GitHub
parent 2414298289
commit a224f19903
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 140 additions and 0 deletions

View file

@ -1201,6 +1201,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -2556,6 +2570,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -3911,6 +3939,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -5266,6 +5308,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -6621,6 +6677,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -7971,6 +8041,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -9321,6 +9405,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -10671,6 +10769,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.
@ -12021,6 +12133,20 @@ def markdown_over_indented():
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
# docstring, even if it isn't valid Python. Since it isn't valid Python,
# reformatting fails and the entire thing is skipped.