當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。