Skip to content

one of the pytest doctests in a docstring not rendered correctly #429

@tmeyier

Description

@tmeyier

Problem Description

One of the doctests in the example below isn´t rendered correctly. The behavior depends on indentation and on the --docformat command argument: see example below.

Steps to reproduce the behavior:

test script doctest_google.py:

def bla():
    """Print bla.

    Examples:
        >>> bla()
        blu

        >>> bla()
        bla
    """
    print("bla")

def bli():
    """Print bli.

    Examples:
    >>> bli()
    bli

    >>> bli()
    blo
    """
    print("bli")
    
bla()
bli()

Apply:

pdoc doctest_google.py

or

pdoc doctest_google.py --docformat restructuredtext

And get this:
20220810_155256

Or apply

pdoc doctest_google.py --docformat google

and get this:
20220810_160505

System Information

pdoc: 12.0.2
Python: 3.9.13

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions