当前位置: 首页>>代码示例>>Python>>正文


Python test.pydoc_mod方法代码示例

本文整理汇总了Python中test.pydoc_mod方法的典型用法代码示例。如果您正苦于以下问题:Python test.pydoc_mod方法的具体用法?Python test.pydoc_mod怎么用?Python test.pydoc_mod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test的用法示例。


在下文中一共展示了test.pydoc_mod方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_pydoc_html

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def get_pydoc_html(module):
    "Returns pydoc generated output as html"
    doc = pydoc.HTMLDoc()
    output = doc.docmodule(module)
    loc = doc.getdocloc(pydoc_mod) or ""
    if loc:
        loc = "<br><a href=\"" + loc + "\">Module Docs</a>"
    return output.strip(), loc 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_pydoc.py

示例2: get_pydoc_text

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def get_pydoc_text(module):
    "Returns pydoc generated output as text"
    doc = pydoc.TextDoc()
    loc = doc.getdocloc(pydoc_mod) or ""
    if loc:
        loc = "\nMODULE DOCS\n    " + loc + "\n"

    output = doc.docmodule(module)

    # cleanup the extra text formatting that pydoc preforms
    patt = re.compile('\b.')
    output = patt.sub('', output)
    return output.strip(), loc 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:test_pydoc.py

示例3: test_html_doc

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def test_html_doc(self):
        result, doc_loc = get_pydoc_html(pydoc_mod)
        mod_file = inspect.getabsfile(pydoc_mod)
        if sys.platform == 'win32':
            import nturl2path
            mod_url = nturl2path.pathname2url(mod_file)
        else:
            mod_url = mod_file
        expected_html = expected_html_pattern % (
                        (mod_url, mod_file, doc_loc) +
                        expected_html_data_docstrings)
        if result != expected_html:
            print_diffs(expected_html, result)
            self.fail("outputs are not equal, see diff above") 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:test_pydoc.py

示例4: test_text_doc

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def test_text_doc(self):
        result, doc_loc = get_pydoc_text(pydoc_mod)
        expected_text = expected_text_pattern % (
                        (inspect.getabsfile(pydoc_mod), doc_loc) +
                        expected_text_data_docstrings)
        if result != expected_text:
            print_diffs(expected_text, result)
            self.fail("outputs are not equal, see diff above") 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_pydoc.py

示例5: get_pydoc_text

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def get_pydoc_text(module):
    "Returns pydoc generated output as text"
    doc = pydoc.TextDoc()
    loc = doc.getdocloc(pydoc_mod) or ""
    if loc:
        loc = "\nMODULE DOCS\n    " + loc + "\n"

    output = doc.docmodule(module)

    # clean up the extra text formatting that pydoc performs
    patt = re.compile('\b.')
    output = patt.sub('', output)
    return output.strip(), loc 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:15,代码来源:test_pydoc.py

示例6: test_html_doc

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def test_html_doc(self):
        result, doc_loc = get_pydoc_html(pydoc_mod)
        mod_file = inspect.getabsfile(pydoc_mod)
        mod_url = urllib.parse.quote(mod_file)
        expected_html = expected_html_pattern % (
                        (mod_url, mod_file, doc_loc) +
                        expected_html_data_docstrings)
        self.assertEqual(result, expected_html) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:10,代码来源:test_pydoc.py

示例7: test_text_doc

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def test_text_doc(self):
        result, doc_loc = get_pydoc_text(pydoc_mod)
        expected_text = expected_text_pattern % (
                        (doc_loc,) +
                        expected_text_data_docstrings +
                        (inspect.getabsfile(pydoc_mod),))
        self.assertEqual(expected_text, result) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:test_pydoc.py

示例8: test_help_output_redirect

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def test_help_output_redirect(self):
        # issue 940286, if output is set in Helper, then all output from
        # Helper.help should be redirected
        old_pattern = expected_text_pattern
        getpager_old = pydoc.getpager
        getpager_new = lambda: (lambda x: x)
        self.maxDiff = None

        buf = StringIO()
        helper = pydoc.Helper(output=buf)
        unused, doc_loc = get_pydoc_text(pydoc_mod)
        module = "test.pydoc_mod"
        help_header = """
        Help on module test.pydoc_mod in test:

        """.lstrip()
        help_header = textwrap.dedent(help_header)
        expected_help_pattern = help_header + expected_text_pattern

        pydoc.getpager = getpager_new
        try:
            with captured_output('stdout') as output, \
                 captured_output('stderr') as err:
                helper.help(module)
                result = buf.getvalue().strip()
                expected_text = expected_help_pattern % (
                                (doc_loc,) +
                                expected_text_data_docstrings +
                                (inspect.getabsfile(pydoc_mod),))
                self.assertEqual('', output.getvalue())
                self.assertEqual('', err.getvalue())
                self.assertEqual(expected_text, result)
        finally:
            pydoc.getpager = getpager_old 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:36,代码来源:test_pydoc.py

示例9: test_html_doc

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def test_html_doc(self):
        result, doc_loc = get_pydoc_html(pydoc_mod)
        mod_file = inspect.getabsfile(pydoc_mod)
        mod_url = urllib.parse.quote(mod_file)
        expected_html = expected_html_pattern % (
                        (mod_url, mod_file, doc_loc) +
                        expected_html_data_docstrings)
        if result != expected_html:
            print_diffs(expected_html, result)
            self.fail("outputs are not equal, see diff above") 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:12,代码来源:test_pydoc.py

示例10: test_text_doc

# 需要导入模块: import test [as 别名]
# 或者: from test import pydoc_mod [as 别名]
def test_text_doc(self):
        result, doc_loc = get_pydoc_text(pydoc_mod)
        expected_text = expected_text_pattern % (
                        (doc_loc,) +
                        expected_text_data_docstrings +
                        (inspect.getabsfile(pydoc_mod),))
        if result != expected_text:
            print_diffs(expected_text, result)
            self.fail("outputs are not equal, see diff above") 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:11,代码来源:test_pydoc.py


注:本文中的test.pydoc_mod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。