summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_pdb.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 69691e9..9ee994e 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -3567,6 +3567,57 @@ class PdbTestReadline(unittest.TestCase):
self.assertIn(b'species', output)
self.assertIn(b'$_frame', output)
+ def test_builtin_completion(self):
+ script = textwrap.dedent("""
+ value = "speci"
+ import pdb; pdb.Pdb().set_trace()
+ """)
+
+ # Complete: print(value + 'al')
+ input = b"pri\tval\t + 'al')\n"
+
+ # Continue
+ input += b"c\n"
+
+ output = run_pty(script, input)
+
+ self.assertIn(b'special', output)
+
+ def test_local_namespace(self):
+ script = textwrap.dedent("""
+ def f():
+ original = "I live Pythin"
+ import pdb; pdb.Pdb().set_trace()
+ f()
+ """)
+
+ # Complete: original.replace('i', 'o')
+ input = b"orig\t.repl\t('i', 'o')\n"
+
+ # Continue
+ input += b"c\n"
+
+ output = run_pty(script, input)
+
+ self.assertIn(b'I love Python', output)
+
+ def test_multiline_completion(self):
+ script = textwrap.dedent("""
+ import pdb; pdb.Pdb().set_trace()
+ """)
+
+ input = b"def func():\n"
+ # Complete: \treturn 40 + 2
+ input += b"\tret\t 40 + 2\n"
+ input += b"\n"
+ # Complete: func()
+ input += b"fun\t()\n"
+ input += b"c\n"
+
+ output = run_pty(script, input)
+
+ self.assertIn(b'42', output)
+
def load_tests(loader, tests, pattern):
from test import test_pdb