1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
def r_prefixed_docstring():
r"""
Wat? Why?!
"""
def function_with_codeblock_in_middle(text):
"""
My comment
.. code-block:: python
function_with_codeblock_in_middle("Hello World")
Some more documentation.
"""
assert text == 'Hello World'
def function_with_single_line_codeblock_at_end(text):
"""
My comment
.. code-block:: python
function_with_single_line_codeblock_at_end("Hello World")
"""
assert text == 'Hello World'
def function_with_multi_line_codeblock_at_end(text):
"""
My comment
.. code-block:: python
function_with_multi_line_codeblock_at_end("Hello")
function_with_multi_line_codeblock_at_end("World")
"""
assert text in ('Hello', 'World')
def decorator(fn):
"""
Example:
>>> def decorated():
... \"\"\"docstring of a decorated function\"\"\"
"""
def ellipsis_as_body():
...
|