mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:47:41 +00:00
Fix codeblock dynamic line length calculation for indented examples (#13523)
This commit is contained in:
parent
7706f561a9
commit
c046101b79
4 changed files with 1276 additions and 20 deletions
|
@ -219,3 +219,72 @@ def doctest_extra_indent3():
|
|||
... df1, df2, df3, on="dt"
|
||||
... ) # doctest: +IGNORE_RESULT
|
||||
"""
|
||||
|
||||
# See https://github.com/astral-sh/ruff/issues/13358
|
||||
def length_doctest():
|
||||
"""Get the length of the given list of numbers.
|
||||
|
||||
Args:
|
||||
numbers: List of numbers.
|
||||
|
||||
Returns:
|
||||
Integer length of the list of numbers.
|
||||
|
||||
Example:
|
||||
>>> length([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
|
||||
20
|
||||
"""
|
||||
|
||||
|
||||
def length_doctest_underindent():
|
||||
"""Get the length of the given list of numbers.
|
||||
|
||||
Args:
|
||||
numbers: List of numbers.
|
||||
|
||||
Returns:
|
||||
Integer length of the list of numbers.
|
||||
|
||||
Example:
|
||||
>>> length([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
|
||||
20
|
||||
"""
|
||||
|
||||
|
||||
# See https://github.com/astral-sh/ruff/issues/13358
|
||||
def length_markdown():
|
||||
"""Get the length of the given list of numbers.
|
||||
|
||||
Args:
|
||||
numbers: List of numbers.
|
||||
|
||||
Returns:
|
||||
Integer length of the list of numbers.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
length([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21])
|
||||
```
|
||||
"""
|
||||
|
||||
|
||||
# See https://github.com/astral-sh/ruff/issues/13358
|
||||
def length_rst():
|
||||
"""
|
||||
Do cool stuff::
|
||||
|
||||
length([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21])
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
# See https://github.com/astral-sh/ruff/issues/13358
|
||||
def length_rst_in_section():
|
||||
"""
|
||||
Examples:
|
||||
Do cool stuff::
|
||||
|
||||
length([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
|
||||
"""
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue