首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何包装超过80个字符的python doctest结果?

如何包装超过80个字符的python doctest结果?
EN

Stack Overflow用户
提问于 2018-07-24 06:26:38
回答 2查看 0关注 0票数 0

不知道如何包装过80个字符的doctest,以下是我的例子:

代码语言:txt
复制
def long_string():
    """
    Returns a string which is wider than the recommended PEP8 linewidth

    >>> print long_string()
    0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

    """
EN

回答 2

Stack Overflow用户

发布于 2018-07-24 15:23:36

这样试试:

代码语言:txt
复制
def long_string():
    """
    Returns a string which is wider than the recommended PEP8 linewidth

    >>> print long_string()
    01234567890123456789012345678901234567890123456789012345678901234567890\
12345678901234567890123456789

    """
    return '0123456789' * 10
票数 0
EN

Stack Overflow用户

发布于 2018-07-24 15:46:49

以下代码可行

代码语言:txt
复制
>>> from test.test_ppp import MockForm
>>> form = MockForm(mock_file='no-errors.xlsx')
>>> form.get_languages(settings_default='English', survey_header=
... form.metadata['raw_data']['survey'][0])  #doctest: +ELLIPSIS
['Ateso', 'English', 'Luganda', ... 'Runyoro-Rutoro']
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100005681

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档