gh-133351: Fix remote PDB's multi-line block tab completion by godlygeek · Pull Request #133387 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Lib/pdb.py
38 changes: 38 additions & 0 deletions Lib/test/test_remote_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,44 @@ def test_completion_in_pdb_state(self):
expected_state={"state": "pdb"},
)

def test_multiline_completion_in_pdb_state(self):
"""Test requesting tab completions at a (Pdb) continuation prompt."""
# GIVEN
incoming = [
Comment on lines +535 to +537

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Test requesting tab completions at a (Pdb) continuation prompt."""
# GIVEN
incoming = [
"""Test requesting tab completions at a (Pdb) continuation prompt."""
incoming = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of agree that #GIVEN is unnecessary here. However, that's consistent with other tests and it's not super important at this point. I do think in the future we should have a cleanup PR to clean these out. It's kind of redundent at this point.

("server", {"prompt": "(Pdb) ", "state": "pdb"}),
("user", {"prompt": "(Pdb) ", "input": "if True:"}),
(
"user",
{
"prompt": "... ",
"completion_request": {
"line": " b",
"begidx": 4,
"endidx": 5,
},
"input": " bool()",
},
),
("server", {"completions": ["bin", "bool", "bytes"]}),
("user", {"prompt": "... ", "input": ""}),
]
self.do_test(
incoming=incoming,
expected_outgoing=[
{
"complete": {
"text": "b",
"line": "! b",
"begidx": 2,
"endidx": 3,
}
},
{"reply": "if True:\n bool()\n"},
],
expected_completions=["bin", "bool", "bytes"],
expected_state={"state": "pdb"},
)

def test_completion_in_interact_state(self):
"""Test requesting tab completions at a >>> prompt."""
incoming = [
Expand Down