https://github.com/python/cpython/commit/b64cc74b14becb874954c1cd2aeddbcf68a39d51 commit: b64cc74b14becb874954c1cd2aeddbcf68a39d51 branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: sobolevn <m...@sobolevn.me> date: 2025-05-02T10:36:35Z summary:
[3.13] gh-133210: Fix `test_pydoc` in `--without-doc-strings` mode (GH-133271) (#133288) gh-133210: Fix `test_pydoc` in `--without-doc-strings` mode (GH-133271) (cherry picked from commit 4912b29166eb23fc7219dbd39d5af0b69bd1a085) Co-authored-by: sobolevn <m...@sobolevn.me> files: M Lib/test/test_pydoc/test_pydoc.py diff --git a/Lib/test/test_pydoc/test_pydoc.py b/Lib/test/test_pydoc/test_pydoc.py index 00ec3cdb3d49e5..10cebfb2801495 100644 --- a/Lib/test/test_pydoc/test_pydoc.py +++ b/Lib/test/test_pydoc/test_pydoc.py @@ -1907,18 +1907,28 @@ def test_text_doc_routines_in_class(self, cls=pydocfodder.B): 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.test_pydoc.pydocfodder', lines) - self.assertIn(' | count(self, value, /) from builtins.list', lines) - self.assertIn(' | list_count = count(self, value, /)', lines) - self.assertIn(' | __repr__(self, /) from builtins.object', lines) - self.assertIn(' | object_repr = __repr__(self, /)', lines) + if not support.MISSING_C_DOCSTRINGS: + self.assertIn(' | count(self, value, /) from builtins.list', lines) + self.assertIn(' | list_count = count(self, value, /)', lines) + self.assertIn(' | __repr__(self, /) from builtins.object', lines) + self.assertIn(' | object_repr = __repr__(self, /)', lines) + else: + self.assertIn(' | count(self, object, /) from builtins.list', lines) + self.assertIn(' | list_count = count(self, object, /)', lines) + self.assertIn(' | __repr__(...) from builtins.object', lines) + self.assertIn(' | object_repr = __repr__(...)', lines) lines = self.getsection(result, f' | Static methods {where}:', ' | ' + '-'*70) 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.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) + if not support.MISSING_C_DOCSTRINGS: + 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) + else: + self.assertIn(' | get(...) method of builtins.dict instance', lines) + self.assertIn(' | dict_get = get(...) method of builtins.dict instance', lines) lines = self.getsection(result, f' | Class methods {where}:', ' | ' + '-'*70) self.assertIn(' | B_classmethod(x)', lines) @@ -1937,10 +1947,16 @@ def test_html_doc_routines_in_class(self, cls=pydocfodder.B): 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.test_pydoc.pydocfodder', lines) - self.assertIn('count(self, value, /) from builtins.list', lines) - self.assertIn('list_count = count(self, value, /)', lines) - self.assertIn('__repr__(self, /) from builtins.object', lines) - self.assertIn('object_repr = __repr__(self, /)', lines) + if not support.MISSING_C_DOCSTRINGS: + self.assertIn('count(self, value, /) from builtins.list', lines) + self.assertIn('list_count = count(self, value, /)', lines) + self.assertIn('__repr__(self, /) from builtins.object', lines) + self.assertIn('object_repr = __repr__(self, /)', lines) + else: + self.assertIn('count(self, object, /) from builtins.list', lines) + self.assertIn('list_count = count(self, object, /)', lines) + self.assertIn('__repr__(...) from builtins.object', lines) + self.assertIn('object_repr = __repr__(...)', lines) lines = self.getsection(result, f'Static methods {where}:', '-'*70) self.assertIn('A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc.pydocfodder.A', lines) @@ -1977,15 +1993,27 @@ def test_text_doc_routines_in_module(self): self.assertIn(' A_method3 = A_method() method of B instance', lines) self.assertIn(' A_staticmethod_ref = A_staticmethod(x, y)', lines) self.assertIn(' A_staticmethod_ref2 = A_staticmethod(y) method of B 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) + if not support.MISSING_C_DOCSTRINGS: + 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) + else: + self.assertIn(' get(...) method of builtins.dict instance', lines) + self.assertIn(' dict_get = get(...) method of builtins.dict instance', lines) + # unbound methods self.assertIn(' B_method(self)', lines) self.assertIn(' B_method2 = B_method(self)', lines) - self.assertIn(' count(self, value, /) unbound builtins.list method', lines) - self.assertIn(' list_count = count(self, value, /) unbound builtins.list method', lines) - self.assertIn(' __repr__(self, /) unbound builtins.object method', lines) - self.assertIn(' object_repr = __repr__(self, /) unbound builtins.object method', lines) + if not support.MISSING_C_DOCSTRINGS: + self.assertIn(' count(self, value, /) unbound builtins.list method', lines) + self.assertIn(' list_count = count(self, value, /) unbound builtins.list method', lines) + self.assertIn(' __repr__(self, /) unbound builtins.object method', lines) + self.assertIn(' object_repr = __repr__(self, /) unbound builtins.object method', lines) + else: + self.assertIn(' count(self, object, /) unbound builtins.list method', lines) + self.assertIn(' list_count = count(self, object, /) unbound builtins.list method', lines) + self.assertIn(' __repr__(...) unbound builtins.object method', lines) + self.assertIn(' object_repr = __repr__(...) unbound builtins.object method', lines) + def test_html_doc_routines_in_module(self): doc = pydoc.HTMLDoc() @@ -2006,15 +2034,25 @@ def test_html_doc_routines_in_module(self): self.assertIn(' A_method3 = A_method() method of B instance', lines) self.assertIn(' A_staticmethod_ref = A_staticmethod(x, y)', lines) self.assertIn(' A_staticmethod_ref2 = A_staticmethod(y) method of B 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) + if not support.MISSING_C_DOCSTRINGS: + 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) + else: + self.assertIn(' get(...) method of builtins.dict instance', lines) + self.assertIn(' dict_get = get(...) method of builtins.dict instance', lines) # unbound methods self.assertIn(' B_method(self)', lines) self.assertIn(' B_method2 = B_method(self)', lines) - self.assertIn(' count(self, value, /) unbound builtins.list method', lines) - self.assertIn(' list_count = count(self, value, /) unbound builtins.list method', lines) - self.assertIn(' __repr__(self, /) unbound builtins.object method', lines) - self.assertIn(' object_repr = __repr__(self, /) unbound builtins.object method', lines) + if not support.MISSING_C_DOCSTRINGS: + self.assertIn(' count(self, value, /) unbound builtins.list method', lines) + self.assertIn(' list_count = count(self, value, /) unbound builtins.list method', lines) + self.assertIn(' __repr__(self, /) unbound builtins.object method', lines) + self.assertIn(' object_repr = __repr__(self, /) unbound builtins.object method', lines) + else: + self.assertIn(' count(self, object, /) unbound builtins.list method', lines) + self.assertIn(' list_count = count(self, object, /) unbound builtins.list method', lines) + self.assertIn(' __repr__(...) unbound builtins.object method', lines) + self.assertIn(' object_repr = __repr__(...) unbound builtins.object method', lines) @unittest.skipIf( _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com