44

ソースコードを PEP8 が推奨する 80 文字のガイドライン幅に収めようとしていますが、結果が 80 文字を超える doctest をラップする方法がわかりません。

うなずく例:

def long_string():
    """
    Returns a string which is wider than the recommended PEP8 linewidth

    >>> print long_string()
    0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

    """
    return '0123456789' * 10

# doctest: +NORMALIZE_WHITESPACE単純に行を改行でラップするなど、いくつかの組み合わせを試しました。

4

2 に答える 2

45

ちょうどわかった:

def long_string():
    """
    Returns a string which is wider than the recommended PEP8 linewidth

    >>> print long_string()
    01234567890123456789012345678901234567890123456789012345678901234567890\
12345678901234567890123456789

    """
    return '0123456789' * 10

それが他の誰かを助けることを願っています。

于 2012-11-15T10:30:28.517 に答える