8000 gh-108303: Move all `pydoc` related files to `test_pydoc` by sobolevn · Pull Request #114506 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-108303: Move all pydoc related files to test_pydoc #114506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge
  • Loading branch information
sobolevn committed Feb 13, 2024
commit 24e087bb0accd2d652b4fd82950a035c9f94b8fc
30 changes: 15 additions & 15 deletions Lib/test/test_pydoc/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
requires_docstrings, MISSING_C_DOCSTRINGS)
from test.support.os_helper import (TESTFN, rmtree, unlink)
from test.test_pydoc import pydoc_mod
from test.test_pydoc import pydocfodder


class nonascii:
Expand Down Expand Up @@ -1141,7 +1142,6 @@ class TestDescriptions(unittest.TestCase):

def test_module(self):
# Check that pydocfodder module can be described
from test.test_pydoc import pydocfodder
doc = pydoc.render_doc(pydocfodder)
self.assertIn("pydocfodder", doc)

Expand Down Expand Up @@ -1427,7 +1427,7 @@ def smeth(*args, **kwargs):
"meth" + bound + " method of test.test_pydoc.test_pydoc.C instance")
C.cmeth.__func__.__text_signature__ = text_signature
self.assertEqual(self._get_summary_line(C.cmeth),
"cmeth" + bound + " class method of test.test_pydoc.C")
"cmeth" + bound + " class method of test.test_pydoc.test_pydoc.C")
C.smeth.__text_signature__ = text_signature
self.assertEqual(self._get_summary_line(C.smeth),
"smeth" + unbound)
Expand Down Expand Up @@ -1464,7 +1464,7 @@ def cm(cls, x):
'cm(...)\n'
' A class method\n')
self.assertEqual(self._get_summary_lines(X.cm), """\
cm(x) class method of test.test_pydoc.X
cm(x) class method of test.test_pydoc.test_pydoc.X
A class method
""")
self.assertIn("""
Expand Down Expand Up @@ -1646,19 +1646,19 @@ def test_text_doc_routines_in_class(self, cls=pydocfodder.B):
lines = self.getsection(result, f' | Methods {where}:', ' | ' + '-'*70)
self.assertIn(' | A_method_alias = A_method(self)', lines)
self.assertIn(' | B_method_alias = B_method(self)', lines)
self.assertIn(' | A_staticmethod(x, y) from test.pydocfodder.A', lines)
self.assertIn(' | A_staticmethod(x, y) from test.test_pydoc.pydocfodder.A', lines)
self.assertIn(' | A_staticmethod_alias = A_staticmethod(x, y)', lines)
self.assertIn(' | global_func(x, y) from test.pydocfodder', lines)
self.assertIn(' | global_func(x, y) from test.test_pydoc.pydocfodder', lines)
self.assertIn(' | global_func_alias = global_func(x, y)', lines)
self.assertIn(' | global_func2_alias = global_func2(x, y) from test.pydocfodder', lines)
self.assertIn(' | global_func2_alias = global_func2(x, y) from test.test_pydoc.pydocfodder', lines)
self.assertIn(' | __repr__(self, /) from builtins.object', lines)
self.assertIn(' | object_repr = __repr__(self, /)', lines)

lines = self.getsection(result, f' | Static methods {where}:', ' | ' + '-'*70)
self.assertIn(' | A_classmethod_ref = A_classmethod(x) class method of test.pydocfodder.A', lines)
note = '' if cls is pydocfodder.B else ' class method of test.pydocfodder.B'
self.assertIn(' | A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc.pydocfodder.A', lines)
note = '' if cls is pydocfodder.B else ' class method of test.test_pydoc.pydocfodder.B'
self.assertIn(' | B_classmethod_ref = B_classmethod(x)' + note, lines)
self.assertIn(' | A_method_ref = A_method() method of test.pydocfodder.A instance', lines)
self.assertIn(' | A_method_ref = A_method() method of test.test_pydoc.pydocfodder.A instance', lines)
self.assertIn(' | get(key, default=None, /) method of builtins.dict instance', lines)
self.assertIn(' | dict_get = get(key, default=None, /) method of builtins.dict instance', lines)

Expand All @@ -1674,19 +1674,19 @@ def test_html_doc_routines_in_class(self, cls=pydocfodder.B):
lines = self.getsection(result, f'Methods {where}:', '-'*70)
self.assertIn('A_method_alias = A_method(self)', lines)
self.assertIn('B_method_alias = B_method(self)', lines)
self.assertIn('A_staticmethod(x, y) from test.pydocfodder.A', lines)
self.assertIn('A_staticmethod(x, y) from test.test_pydoc.pydocfodder.A', lines)
self.assertIn('A_staticmethod_alias = A_staticmethod(x, y)', lines)
self.assertIn('global_func(x, y) from test.pydocfodder', lines)
self.assertIn('global_func(x, y) from test.test_pydoc.pydocfodder', lines)
self.assertIn('global_func_alias = global_func(x, y)', lines)
self.assertIn('global_func2_alias = global_func2(x, y) from test.pydocfodder', lines)
self.assertIn('global_func2_alias = global_func2(x, y) from test.test_pydoc.pydocfodder', lines)
self.assertIn('__repr__(self, /) from builtins.object', lines)
self.assertIn('object_repr = __repr__(self, /)', lines)

lines = self.getsection(result, f'Static methods {where}:', '-'*70)
self.assertIn('A_classmethod_ref = A_classmethod(x) class method of test.pydocfodder.A', lines)
note = '' if cls is pydocfodder.B else ' class method of test.pydocfodder.B'
self.assertIn('A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc.pydocfodder.A', lines)
note = '' if cls is pydocfodder.B else ' class method of test.test_pydoc.pydocfodder.B'
self.assertIn('B_classmethod_ref = B_classmethod(x)' + note, lines)
self.assertIn('A_method_ref = A_method() method of test.pydocfodder.A instance', lines)
self.assertIn('A_method_ref = A_method() method of test.test_pydoc.pydocfodder.A instance', lines)

lines = self.getsection(result, f'Class methods {where}:', '-'*70)
self.assertIn('B_classmethod(x)', lines)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0