34
34
captured_stderr , is_emscripten , is_wasi ,
35
35
requires_docstrings , MISSING_C_DOCSTRINGS )
36
36
from test .support .os_helper import (TESTFN , rmtree , unlink )
37
- from test import pydoc_mod
38
- from test import pydocfodder
37
+ from test . test_pydoc import pydoc_mod
38
+ from test . test_pydoc import pydocfodder
39
39
40
40
41
41
class nonascii :
@@ -52,7 +52,7 @@ class nonascii:
52
52
53
53
expected_text_pattern = """
54
54
NAME
55
- test.pydoc_mod - This is a test module for test_pydoc
55
+ test.test_pydoc. pydoc_mod - This is a test module for test_pydoc
56
56
%s
57
57
CLASSES
58
58
builtins.object
@@ -125,7 +125,7 @@ class C(builtins.object)
125
125
126
126
DATA
127
127
__xyz__ = 'X, Y and Z'
128
- c_alias = test.pydoc_mod.C[int]
128
+ c_alias = test.test_pydoc. pydoc_mod.C[int]
129
129
list_alias1 = typing.List[int]
130
130
list_alias2 = list[int]
131
131
type_union1 = typing.Union[int, str]
@@ -148,7 +148,7 @@ class C(builtins.object)
148
148
for s in expected_data_docstrings )
149
149
150
150
html2text_of_expected = """
151
- test.pydoc_mod (version 1.2.3.4)
151
+ test.test_pydoc. pydoc_mod (version 1.2.3.4)
152
152
This is a test module for test_pydoc
153
153
154
154
Modules
@@ -213,7 +213,7 @@ class C(builtins.object)
213
213
214
214
Data
215
215
__xyz__ = 'X, Y and Z'
216
- c_alias = test.pydoc_mod.C[int]
216
+ c_alias = test.test_pydoc. pydoc_mod.C[int]
217
217
list_alias1 = typing.List[int]
218
218
list_alias2 = list[int]
219
219
type_union1 = typing.Union[int, str]
@@ -342,7 +342,7 @@ def get_pydoc_link(module):
342
342
"Returns a documentation web link of a module"
343
343
abspath = os .path .abspath
344
344
dirname = os .path .dirname
345
- basedir = dirname (dirname (abspath (__file__ )))
345
+ basedir = dirname (dirname (dirname ( abspath (__file__ ) )))
346
346
doc = pydoc .TextDoc ()
347
347
loc = doc .getdocloc (module , basedir = basedir )
348
348
return loc
@@ -489,7 +489,7 @@ def test_not_here(self):
489
489
490
490
@requires_docstrings
491
491
def test_not_ascii (self ):
492
- result = run_pydoc ('test.test_pydoc.nonascii' , PYTHONIOENCODING = 'ascii' )
492
+ result = run_pydoc ('test.test_pydoc.test_pydoc. nonascii' , PYTHONIOENCODING = 'ascii' )
493
493
encoded = nonascii .__doc__ .encode ('ascii' , 'backslashreplace' )
494
494
self .assertIn (encoded , result )
495
495
@@ -669,9 +669,9 @@ def test_help_output_redirect(self):
669
669
buf = StringIO ()
670
670
helper = pydoc .Helper (output = buf )
671
671
unused , doc_loc = get_pydoc_text (pydoc_mod )
672
- module = "test.pydoc_mod"
672
+ module = "test.test_pydoc. pydoc_mod"
673
673
help_header = """
674
- Help on module test.pydoc_mod in test:
674
+ Help on module test.test_pydoc. pydoc_mod in test.test_pydoc :
675
675
676
676
""" .lstrip ()
677
677
help_header = textwrap .dedent (help_header )
@@ -1142,7 +1142,6 @@ class TestDescriptions(unittest.TestCase):
1142
1142
1143
1143
def test_module (self ):
1144
1144
# Check that pydocfodder module can be described
1145
- from test import pydocfodder
1146
1145
doc = pydoc .render_doc (pydocfodder )
1147
1146
self .assertIn ("pydocfodder" , doc )
1148
1147
@@ -1425,10 +1424,10 @@ def smeth(*args, **kwargs):
1425
1424
self .assertEqual (self ._get_summary_line (C .meth ),
1426
1425
"meth" + unbound )
1427
1426
self .assertEqual (self ._get_summary_line (C ().meth ),
1428
- "meth" + bound + " method of test.test_pydoc.C instance" )
1427
+ "meth" + bound + " method of test.test_pydoc.test_pydoc. C instance" )
1429
1428
C .cmeth .__func__ .__text_signature__ = text_signature
1430
1429
self .assertEqual (self ._get_summary_line (C .cmeth ),
1431
- "cmeth" + bound + " class method of test.test_pydoc.C" )
1430
+ "cmeth" + bound + " class method of test.test_pydoc.test_pydoc. C" )
1432
1431
C .smeth .__text_signature__ = text_signature
1433
1432
self .assertEqual (self ._get_summary_line (C .smeth ),
1434
1433
"smeth" + unbound )
@@ -1465,7 +1464,7 @@ def cm(cls, x):
1465
1464
'cm(...)\n '
1466
1465
' A class method\n ' )
1467
1466
self .assertEqual (self ._get_summary_lines (X .cm ), """\
1468
- cm(x) class method of test.test_pydoc.X
1467
+ cm(x) class method of test.test_pydoc.test_pydoc. X
1469
1468
A class method
1470
1469
""" )
1471
1470
self .assertIn ("""
@@ -1647,19 +1646,19 @@ def test_text_doc_routines_in_class(self, cls=pydocfodder.B):
1647
1646
lines = self .getsection (result , f' | Methods { where } :' , ' | ' + '-' * 70 )
1648
1647
self .assertIn (' | A_method_alias = A_method(self)' , lines )
1649
1648
self .assertIn (' | B_method_alias = B_method(self)' , lines )
1650
- self .assertIn (' | A_staticmethod(x, y) from test.pydocfodder.A' , lines )
1649
+ self .assertIn (' | A_staticmethod(x, y) from test.test_pydoc. pydocfodder.A' , lines )
1651
1650
self .assertIn (' | A_staticmethod_alias = A_staticmethod(x, y)' , lines )
1652
- self .assertIn (' | global_func(x, y) from test.pydocfodder' , lines )
1651
+ self .assertIn (' | global_func(x, y) from test.test_pydoc. pydocfodder' , lines )
1653
1652
self .assertIn (' | global_func_alias = global_func(x, y)' , lines )
1654
- self .assertIn (' | global_func2_alias = global_func2(x, y) from test.pydocfodder' , lines )
1653
+ self .assertIn (' | global_func2_alias = global_func2(x, y) from test.test_pydoc. pydocfodder' , lines )
1655
1654
self .assertIn (' | __repr__(self, /) from builtins.object' , lines )
1656
1655
self .assertIn (' | object_repr = __repr__(self, /)' , lines )
1657
1656
1658
1657
lines = self .getsection (result , f' | Static methods { where } :' , ' | ' + '-' * 70 )
1659
- self .assertIn (' | A_classmethod_ref = A_classmethod(x) class method of test.pydocfodder.A' , lines )
1660
- note = '' if cls is pydocfodder .B else ' class method of test.pydocfodder.B'
1658
+ self .assertIn (' | A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc. pydocfodder.A' , lines )
1659
+ note = '' if cls is pydocfodder .B else ' class method of test.test_pydoc. pydocfodder.B'
1661
1660
self .assertIn (' | B_classmethod_ref = B_classmethod(x)' + note , lines )
1662
- self .assertIn (' | A_method_ref = A_method() method of test.pydocfodder.A instance' , lines )
1661
+ self .assertIn (' | A_method_ref = A_method() method of test.test_pydoc. pydocfodder.A instance' , lines )
1663
1662
self .assertIn (' | get(key, default=None, /) method of builtins.dict instance' , lines )
1664
1663
self .assertIn (' | dict_get = get(key, default=None, /) method of builtins.dict instance' , lines )
1665
1664
@@ -1675,19 +1674,19 @@ def test_html_doc_routines_in_class(self, cls=pydocfodder.B):
1675
1674
lines = self .getsection (result , f'Methods { where } :' , '-' * 70 )
1676
1675
self .assertIn ('A_method_alias = A_method(self)' , lines )
1677
1676
self .assertIn ('B_method_alias = B_method(self)' , lines )
1678
- self .assertIn ('A_staticmethod(x, y) from test.pydocfodder.A' , lines )
1677
+ self .assertIn ('A_staticmethod(x, y) from test.test_pydoc. pydocfodder.A' , lines )
1679
1678
self .assertIn ('A_staticmethod_alias = A_staticmethod(x, y)' , lines )
1680
- self .assertIn ('global_func(x, y) from test.pydocfodder' , lines )
1679
+ self .assertIn ('global_func(x, y) from test.test_pydoc. pydocfodder' , lines )
1681
1680
self .assertIn ('global_func_alias = global_func(x, y)' , lines )
1682
- self .assertIn ('global_func2_alias = global_func2(x, y) from test.pydocfodder' , lines )
1681
+ self .assertIn ('global_func2_alias = global_func2(x, y) from test.test_pydoc. pydocfodder' , lines )
1683
1682
self .assertIn ('__repr__(self, /) from builtins.object' , lines )
1684
1683
self .assertIn ('object_repr = __repr__(self, /)' , lines )
1685
1684
1686
1685
lines = self .getsection (result , f'Static methods { where } :' , '-' * 70 )
1687
- self .assertIn ('A_classmethod_ref = A_classmethod(x) class method of test.pydocfodder.A' , lines )
1688
- note = '' if cls is pydocfodder .B else ' class method of test.pydocfodder.B'
1686
+ self .assertIn ('A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc. pydocfodder.A' , lines )
1687
+ note = '' if cls is pydocfodder .B else ' class method of test.test_pydoc. pydocfodder.B'
1689
1688
self .assertIn ('B_classmethod_ref = B_classmethod(x)' + note , lines )
1690
- self .assertIn ('A_method_ref = A_method() method of test.pydocfodder.A instance' , lines )
1689
+ self .assertIn ('A_method_ref = A_method() method of test.test_pydoc. pydocfodder.A instance' , lines )
1691
1690
1692
1691
lines = self .getsection (result , f'Class methods { where } :' , '-' * 70 )
1693
1692
self .assertIn ('B_classmethod(x)' , lines )
0 commit comments