https://github.com/python/cpython/commit/e090f8e3f59f5eec8158c891b30f6450b57dab00
commit: e090f8e3f59f5eec8158c891b30f6450b57dab00
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: sobolevn <m...@sobolevn.me>
date: 2025-05-03T16:01:36Z
summary:

[3.13] gh-133210: Fix `test_rlcompleter` in `--without-doc-strings` mode 
(GH-133332) (#133348)

gh-133210: Fix `test_rlcompleter` in `--without-doc-strings` mode (GH-133332)
(cherry picked from commit 881144fa585bfb03441b29a8b62f89154c668fd4)

Co-authored-by: sobolevn <m...@sobolevn.me>

files:
M Lib/test/test_rlcompleter.py

diff --git a/Lib/test/test_rlcompleter.py b/Lib/test/test_rlcompleter.py
index 1cff6a218f8d75..d403a0fe96be3d 100644
--- a/Lib/test/test_rlcompleter.py
+++ b/Lib/test/test_rlcompleter.py
@@ -54,11 +54,26 @@ def test_attr_matches(self):
                          ['str.{}('.format(x) for x in dir(str)
                           if x.startswith('s')])
         self.assertEqual(self.stdcompleter.attr_matches('tuple.foospamegg'), 
[])
-        expected = sorted({'None.%s%s' % (x,
-                                          '()' if x in ('__init_subclass__', 
'__class__')
-                                          else '' if x == '__doc__'
-                                          else '(')
-                           for x in dir(None)})
+
+        def create_expected_for_none():
+            if not MISSING_C_DOCSTRINGS:
+                parentheses = ('__init_subclass__', '__class__')
+            else:
+                # When `--without-doc-strings` is used, `__class__`
+                # won't have a known signature.
+                parentheses = ('__init_subclass__',)
+
+            items = set()
+            for x in dir(None):
+                if x in parentheses:
+                    items.add(f'None.{x}()')
+                elif x == '__doc__':
+                    items.add(f'None.{x}')
+                else:
+                    items.add(f'None.{x}(')
+            return sorted(items)
+
+        expected = create_expected_for_none()
         self.assertEqual(self.stdcompleter.attr_matches('None.'), expected)
         self.assertEqual(self.stdcompleter.attr_matches('None._'), expected)
         self.assertEqual(self.stdcompleter.attr_matches('None.__'), expected)

_______________________________________________
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

Reply via email to