aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_pdb.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index ae84fe3ce7d..be365a5a3dd 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -4855,6 +4855,34 @@ class PdbTestReadline(unittest.TestCase):
self.assertIn(b'4', output)
self.assertNotIn(b'Error', output)
+ def test_interact_completion(self):
+ script = textwrap.dedent("""
+ value = "speci"
+ import pdb; pdb.Pdb().set_trace()
+ """)
+
+ # Enter interact mode
+ input = b"interact\n"
+ # Should fail to complete 'display' because that's a pdb command
+ input += b"disp\t\n"
+ # 'value' should still work
+ input += b"val\t + 'al'\n"
+ # Let's define a function to test <tab>
+ input += b"def f():\n"
+ input += b"\treturn 42\n"
+ input += b"\n"
+ input += b"f() * 2\n"
+ # Exit interact mode
+ input += b"exit()\n"
+ # continue
+ input += b"c\n"
+
+ output = run_pty(script, input)
+
+ self.assertIn(b"'disp' is not defined", output)
+ self.assertIn(b'special', output)
+ self.assertIn(b'84', output)
+
def load_tests(loader, tests, pattern):
from test import test_pdb