32
32
captured_stderr , is_emscripten , is_wasi ,
33
33
requires_docstrings , MISSING_C_DOCSTRINGS )
34
34
from test .support .os_helper import (TESTFN , rmtree , unlink )
35
- from test import pydoc_mod
36
- from test import pydocfodder
35
+ from test . test_pydoc import pydoc_mod
36
+ from test . test_pydoc import pydocfodder
37
37
38
38
39
39
class nonascii :
@@ -50,7 +50,7 @@ class nonascii:
50
50
51
51
expected_text_pattern = """
52
52
NAME
53
- test.pydoc_mod - This is a test module for test_pydoc
53
+ test.test_pydoc. pydoc_mod - This is a test module for test_pydoc
54
54
%s
55
55
CLASSES
56
56
builtins.object
@@ -123,7 +123,7 @@ class C(builtins.object)
123
123
124
124
DATA
125
125
__xyz__ = 'X, Y and Z'
126
- c_alias = test.pydoc_mod.C[int]
126
+ c_alias = test.test_pydoc. pydoc_mod.C[int]
127
127
list_alias1 = typing.List[int]
128
128
list_alias2 = list[int]
129
129
type_union1 = typing.Union[int, str]
@@ -146,7 +146,7 @@ class C(builtins.object)
146
146
for s in expected_data_docstrings )
147
147
148
148
html2text_of_expected = """
149
- test.pydoc_mod (version 1.2.3.4)
149
+ test.test_pydoc. pydoc_mod (version 1.2.3.4)
150
150
This is a test module for test_pydoc
151
151
152
152
Modules
@@ -211,7 +211,7 @@ class C(builtins.object)
211
211
212
212
Data
213
213
__xyz__ = 'X, Y and Z'
214
- c_alias = test.pydoc_mod.C[int]
214
+ c_alias = test.test_pydoc. pydoc_mod.C[int]
215
215
list_alias1 = typing.List[int]
216
216
list_alias2 = list[int]
217
217
type_union1 = typing.Union[int, str]
@@ -340,7 +340,7 @@ def get_pydoc_link(module):
340
340
"Returns a documentation web link of a module"
341
341
abspath = os .path .abspath
342
342
dirname = os .path .dirname
343
- basedir = dirname (dirname (abspath (__file__ )))
343
+ basedir = dirname (dirname (dirname ( abspath (__file__ ) )))
344
344
doc = pydoc .TextDoc ()
345
345
loc = doc .getdocloc (module , basedir = basedir )
346
346
return loc
@@ -487,7 +487,7 @@ def test_not_here(self):
487
487
488
488
@requires_docstrings
489
489
def test_not_ascii (self ):
490
- result = run_pydoc ('test.test_pydoc.nonascii' , PYTHONIOENCODING = 'ascii' )
490
+ result = run_pydoc ('test.test_pydoc.test_pydoc. nonascii' , PYTHONIOENCODING = 'ascii' )
491
491
encoded = nonascii .__doc__ .encode ('ascii' , 'backslashreplace' )
492
492
self .assertIn (encoded , result )
493
493
@@ -667,9 +667,9 @@ def test_help_output_redirect(self):
667
667
buf = StringIO ()
668
668
helper = pydoc .Helper (output = buf )
669
669
unused , doc_loc = get_pydoc_text (pydoc_mod )
670
- module = "test.pydoc_mod"
670
+ module = "test.test_pydoc. pydoc_mod"
671
671
help_header = """
672
- Help on module test.pydoc_mod in test:
672
+ Help on module test.test_pydoc. pydoc_mod in test.test_pydoc :
673
673
674
674
""" .lstrip ()
675
675
help_header = textwrap .dedent (help_header )
@@ -1050,7 +1050,6 @@ class TestDescriptions(unittest.TestCase):
1050
1050
1051
1051
def test_module (self ):
1052
1052
# Check that pydocfodder module can be described
1053
- from test import pydocfodder
1054
1053
doc = pydoc .render_doc (pydocfodder )
1055
1054
self .assertIn ("pydocfodder" , doc )
1056
1055
@@ -1229,7 +1228,7 @@ def cm(cls, x):
1229
1228
'cm(...)\n '
1230
1229
' A class method\n ' )
1231
1230
self .assertEqual (self ._get_summary_lines (X .cm ), """\
1232
- cm(x) class method of test.test_pydoc.X
1231
+ cm(x) class method of test.test_pydoc.test_pydoc. X
1233
1232
A class method
1234
1233
""" )
1235
1234
self .assertIn ("""
@@ -1411,19 +1410,19 @@ def test_text_doc_routines_in_class(self, cls=pydocfodder.B):
1411
1410
lines = self .getsection (result , f' | Methods { where } :' , ' | ' + '-' * 70 )
1412
1411
self .assertIn (' | A_method_alias = A_method(self)' , lines )
1413
1412
self .assertIn (' | B_method_alias = B_method(self)' , lines )
1414
- self .assertIn (' | A_staticmethod(x, y) from test.pydocfodder.A' , lines )
1413
+ self .assertIn (' | A_staticmethod(x, y) from test.test_pydoc. pydocfodder.A' , lines )
1415
1414
self .assertIn (' | A_staticmethod_alias = A_staticmethod(x, y)' , lines )
1416
- self .assertIn (' | global_func(x, y) from test.pydocfodder' , lines )
1415
+ self .assertIn (' | global_func(x, y) from test.test_pydoc. pydocfodder' , lines )
1417
1416
self .assertIn (' | global_func_alias = global_func(x, y)' , lines )
1418
- self .assertIn (' | global_func2_alias = global_func2(x, y) from test.pydocfodder' , lines )
1417
+ self .assertIn (' | global_func2_alias = global_func2(x, y) from test.test_pydoc. pydocfodder' , lines )
1419
1418
self .assertIn (' | __repr__(self, /) from builtins.object' , lines )
1420
1419
self .assertIn (' | object_repr = __repr__(self, /)' , lines )
1421
1420
1422
1421
lines = self .getsection (result , f' | Static methods { where } :' , ' | ' + '-' * 70 )
1423
- self .assertIn (' | A_classmethod_ref = A_classmethod(x) class method of test.pydocfodder.A' , lines )
1424
- note = '' if cls is pydocfodder .B else ' class method of test.pydocfodder.B'
1422
+ self .assertIn (' | A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc. pydocfodder.A' , lines )
1423
+ note = '' if cls is pydocfodder .B else ' class method of test.test_pydoc. pydocfodder.B'
1425
1424
self .assertIn (' | B_classmethod_ref = B_classmethod(x)' + note , lines )
1426
- self .assertIn (' | A_method_ref = A_method() method of test.pydocfodder.A instance' , lines )
1425
+ self .assertIn (' | A_method_ref = A_method() method of test.test_pydoc. pydocfodder.A instance' , lines )
1427
1426
self .assertIn (' | get(key, default=None, /) method of builtins.dict instance' , lines )
1428
1427
self .assertIn (' | dict_get = get(key, default=None, /) method of builtins.dict instance' , lines )
1429
1428
@@ -1439,19 +1438,19 @@ def test_html_doc_routines_in_class(self, cls=pydocfodder.B):
1439
1438
lines = self .getsection (result , f'Methods { where } :' , '-' * 70 )
1440
1439
self .assertIn ('A_method_alias = A_method(self)' , lines )
1441
1440
self .assertIn ('B_method_alias = B_method(self)' , lines )
1442
- self .assertIn ('A_staticmethod(x, y) from test.pydocfodder.A' , lines )
1441
+ self .assertIn ('A_staticmethod(x, y) from test.test_pydoc. pydocfodder.A' , lines )
1443
1442
self .assertIn ('A_staticmethod_alias = A_staticmethod(x, y)' , lines )
1444
- self .assertIn ('global_func(x, y) from test.pydocfodder' , lines )
1443
+ self .assertIn ('global_func(x, y) from test.test_pydoc. pydocfodder' , lines )
1445
1444
self .assertIn ('global_func_alias = global_func(x, y)' , lines )
1446
- self .assertIn ('global_func2_alias = global_func2(x, y) from test.pydocfodder' , lines )
1445
+ self .assertIn ('global_func2_alias = global_func2(x, y) from test.test_pydoc. pydocfodder' , lines )
1447
1446
self .assertIn ('__repr__(self, /) from builtins.object' , lines )
1448
1447
self .assertIn ('object_repr = __repr__(self, /)' , lines )
1449
1448
1450
1449
lines = self .getsection (result , f'Static methods { where } :' , '-' * 70 )
1451
- self .assertIn ('A_classmethod_ref = A_classmethod(x) class method of test.pydocfodder.A' , lines )
1452
- note = '' if cls is pydocfodder .B else ' class method of test.pydocfodder.B'
1450
+ self .assertIn ('A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc. pydocfodder.A' , lines )
1451
+ note = '' if cls is pydocfodder .B else ' class method of test.test_pydoc. pydocfodder.B'
1453
1452
self .assertIn ('B_classmethod_ref = B_classmethod(x)' + note , lines )
1454
- self .assertIn ('A_method_ref = A_method() method of test.pydocfodder.A instance' , lines )
1453
+ self .assertIn ('A_method_ref = A_method() method of test.test_pydoc. pydocfodder.A instance' , lines )
1455
1454
1456
1455
lines = self .getsection (result , f'Class methods { where } :' , '-' * 70 )
1457
1456
self .assertIn ('B_classmethod(x)' , lines )
0 commit comments