diff options
author | James Gerity <snoopjedi@gmail.com> | 2023-05-11 17:12:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 17:12:02 (GMT) |
commit | 0449ffe3a4ddf03367a5ee3d943c89f442b7b407 (patch) | |
tree | 725782510197d69b2f23bda34d2e1942a1335463 /Lib/test/test_pdb.py | |
parent | 27419a71b5aa18baf24f4e640c5a6e8df9338928 (diff) | |
download | cpython-0449ffe3a4ddf03367a5ee3d943c89f442b7b407.zip cpython-0449ffe3a4ddf03367a5ee3d943c89f442b7b407.tar.gz cpython-0449ffe3a4ddf03367a5ee3d943c89f442b7b407.tar.bz2 |
gh-104301: Allow leading whitespace in disambiguated pdb statements (#104342)
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r-- | Lib/test/test_pdb.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 482c92d..037673d 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1798,6 +1798,29 @@ def test_pdb_issue_gh_101517(): (Pdb) continue """ +def test_pdb_ambiguous_statements(): + """See GH-104301 + + Make sure that ambiguous statements prefixed by '!' are properly disambiguated + + >>> with PdbTestInput([ + ... '! n = 42', # disambiguated statement: reassign the name n + ... 'n', # advance the debugger into the print() + ... 'continue' + ... ]): + ... n = -1 + ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + ... print(f"The value of n is {n}") + > <doctest test.test_pdb.test_pdb_ambiguous_statements[0]>(8)<module>() + -> print(f"The value of n is {n}") + (Pdb) ! n = 42 + (Pdb) n + The value of n is 42 + > <doctest test.test_pdb.test_pdb_ambiguous_statements[0]>(1)<module>() + -> with PdbTestInput([ + (Pdb) continue + """ + @support.requires_subprocess() class PdbTestCase(unittest.TestCase): |