| 1 |
"""Module docstring""" |
| 2 |
|
| 3 |
# Test docstring extraction |
| 4 |
from gettext import gettext as _ |
| 5 |
|
| 6 |
|
| 7 |
# Empty docstring |
| 8 |
def test(x): |
| 9 |
"""""" |
| 10 |
|
| 11 |
|
| 12 |
# Leading empty line |
| 13 |
def test2(x): |
| 14 |
|
| 15 |
"""docstring""" |
| 16 |
|
| 17 |
|
| 18 |
# Multiline docstrings are cleaned with `inspect.cleandoc`. |
| 19 |
def test3(x): |
| 20 |
"""multiline |
| 21 |
docstring |
| 22 |
""" |
| 23 |
|
| 24 |
|
| 25 |
# Multiple docstrings - only the first should be extracted |
| 26 |
def test4(x): |
| 27 |
"""docstring1""" |
| 28 |
"""docstring2""" |
| 29 |
|
| 30 |
|
| 31 |
def test5(x): |
| 32 |
"""Hello, {}!""".format("world!") # This should not be extracted. |
| 33 |
|
| 34 |
|
| 35 |
# Nested docstrings |
| 36 |
def test6(x): |
| 37 |
def inner(y): |
| 38 |
"""nested docstring""" |
| 39 |
|
| 40 |
|
| 41 |
class Outer: |
| 42 |
class Inner: |
| 43 |
"nested class docstring" |