Kaydet (Commit) aeb2e829 authored tarafından Brian Curtin's avatar Brian Curtin

Fix #8225. xml.etree was displaying an incorrect link when viewed in help.

üst b102ddad
...@@ -356,7 +356,8 @@ class Doc: ...@@ -356,7 +356,8 @@ class Doc:
'marshal', 'posix', 'signal', 'sys', 'marshal', 'posix', 'signal', 'sys',
'thread', 'zipimport') or 'thread', 'zipimport') or
(file.startswith(basedir) and (file.startswith(basedir) and
not file.startswith(os.path.join(basedir, 'site-packages'))))): not file.startswith(os.path.join(basedir, 'site-packages')))) and
object.__name__ not in ('xml.etree')):
if docloc.startswith("http://"): if docloc.startswith("http://"):
docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__) docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__)
else: else:
......
...@@ -7,6 +7,7 @@ import re ...@@ -7,6 +7,7 @@ import re
import pydoc import pydoc
import inspect import inspect
import unittest import unittest
import xml.etree
import test.test_support import test.test_support
from contextlib import contextmanager from contextlib import contextmanager
from test.test_support import ( from test.test_support import (
...@@ -244,6 +245,11 @@ class PyDocDocTest(unittest.TestCase): ...@@ -244,6 +245,11 @@ class PyDocDocTest(unittest.TestCase):
print_diffs(expected_text, result) print_diffs(expected_text, result)
self.fail("outputs are not equal, see diff above") self.fail("outputs are not equal, see diff above")
def test_issue8225(self):
# Test issue8225 to ensure no doc link appears for xml.etree
result, doc_loc = get_pydoc_text(xml.etree)
self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link")
def test_not_here(self): def test_not_here(self):
missing_module = "test.i_am_not_here" missing_module = "test.i_am_not_here"
result = run_pydoc(missing_module) result = run_pydoc(missing_module)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment