Test handling completion requests.
(self)
| 882 | self.pdb._read_reply() |
| 883 | |
| 884 | def test_completion(self): |
| 885 | """Test handling completion requests.""" |
| 886 | # Mock completenames to return specific values |
| 887 | with unittest.mock.patch.object(self.pdb, 'completenames', |
| 888 | return_value=["continue", "clear"]): |
| 889 | |
| 890 | # Add a completion request |
| 891 | self.sockfile.add_input({ |
| 892 | "complete": { |
| 893 | "text": "c", |
| 894 | "line": "c", |
| 895 | "begidx": 0, |
| 896 | "endidx": 1 |
| 897 | } |
| 898 | }) |
| 899 | |
| 900 | # Add a regular command to break the loop |
| 901 | self.sockfile.add_input({"reply": "help"}) |
| 902 | |
| 903 | # Read command - this should process the completion request first |
| 904 | cmd = self.pdb._read_reply() |
| 905 | |
| 906 | # Verify completion response was sent |
| 907 | outputs = self.sockfile.get_output() |
| 908 | self.assertEqual(len(outputs), 1) |
| 909 | self.assertEqual(outputs[0], {"completions": ["continue", "clear"]}) |
| 910 | |
| 911 | # The actual command should be returned |
| 912 | self.assertEqual(cmd, "help") |
| 913 | |
| 914 | def test_do_help(self): |
| 915 | """Test that do_help sends the help message.""" |
nothing calls this directly
no test coverage detected