Skip to content

Commit

Permalink
ruff_python_formatter: add test for extraneous info string text
Browse files Browse the repository at this point in the history
@ofek asked [about this][ref]. I did specifically add support for it,
but neglected to add a test. This PR adds a test.

[ref]: #9030 (comment)
  • Loading branch information
BurntSushi committed Dec 7, 2023
1 parent 6bbabce commit 77b68f5
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 77b68f5

Please sign in to comment.