gh-110944: Make pdb completion work for alias and convenience vars (GH-110945)

This commit is contained in:
Tian Gao 2023-11-14 04:22:25 -08:00 committed by GitHub
parent 324531df90
commit f44d6ff6e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 1 deletions

View file

@ -3289,6 +3289,27 @@ class PdbTestReadline(unittest.TestCase):
self.assertIn(b'continue', output)
self.assertIn(b'hello!', output)
def test_expression_completion(self):
script = textwrap.dedent("""
value = "speci"
import pdb; pdb.Pdb().set_trace()
""")
# Complete: value + 'al'
input = b"val\t + 'al'\n"
# Complete: p value + 'es'
input += b"p val\t + 'es'\n"
# Complete: $_frame
input += b"$_fra\t\n"
# Continue
input += b"c\n"
output = run_pty(script, input)
self.assertIn(b'special', output)
self.assertIn(b'species', output)
self.assertIn(b'$_frame', output)
def load_tests(loader, tests, pattern):
from test import test_pdb