bpo-37765: Add keywords to IDLE tab completions (GH-15138)

Keywords are present in the main module tab completion lists generated by rlcompleter, which is used by REPLs on *nix. Add all keywords to IDLE's main module name list except those already added from builtins (True, False, and None) . This list may also be used by Show Completions on the Edit menu, and its hot key.

Rewrite Completions doc.

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
(cherry picked from commit bce2eb4646)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
Miss Islington (bot) 2020-07-09 15:54:14 -07:00 committed by GitHub
parent c65ee55512
commit fd27fb7f3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 104 additions and 77 deletions

View file

@ -240,8 +240,11 @@ class AutoCompleteTest(unittest.TestCase):
with patch.dict('__main__.__dict__', {'__all__': ['a', 'b']}):
s, b = acp.fetch_completions('', ac.ATTRS)
self.assertEqual(s, ['a', 'b'])
self.assertIn('__name__', b) # From __main__.__dict__
self.assertIn('sum', b) # From __main__.__builtins__.__dict__
self.assertIn('__name__', b) # From __main__.__dict__.
self.assertIn('sum', b) # From __main__.__builtins__.__dict__.
self.assertIn('nonlocal', b) # From keyword.kwlist.
pos = b.index('False') # Test False not included twice.
self.assertNotEqual(b[pos+1], 'False')
# Test attributes with name entity.
mock = Mock()