2025-02-11 12:51:42 +01:00
|
|
|
"""Module docstring"""
|
|
|
|
|
|
2024-11-03 15:01:09 +01:00
|
|
|
# Test docstring extraction
|
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Empty docstring
|
|
|
|
|
def test(x):
|
|
|
|
|
""""""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Leading empty line
|
|
|
|
|
def test2(x):
|
|
|
|
|
|
2025-02-11 12:51:42 +01:00
|
|
|
"""docstring"""
|
2024-11-03 15:01:09 +01:00
|
|
|
|
|
|
|
|
|
2025-02-11 12:51:42 +01:00
|
|
|
# Multiline docstrings are cleaned with `inspect.cleandoc`.
|
2024-11-03 15:01:09 +01:00
|
|
|
def test3(x):
|
|
|
|
|
"""multiline
|
|
|
|
|
docstring
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Multiple docstrings - only the first should be extracted
|
|
|
|
|
def test4(x):
|
|
|
|
|
"""docstring1"""
|
|
|
|
|
"""docstring2"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test5(x):
|
2025-02-11 12:51:42 +01:00
|
|
|
"""Hello, {}!""".format("world!") # This should not be extracted.
|
2024-11-03 15:01:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Nested docstrings
|
|
|
|
|
def test6(x):
|
|
|
|
|
def inner(y):
|
2025-02-11 12:51:42 +01:00
|
|
|
"""nested docstring"""
|
2024-11-03 15:01:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Outer:
|
|
|
|
|
class Inner:
|
2025-02-11 12:51:42 +01:00
|
|
|
"nested class docstring"
|