MCPcopy Index your code
hub / github.com/python/cpython / test_completion

Method test_completion

Lib/test/test_remote_pdb.py:884–912  ·  view source on GitHub ↗

Test handling completion requests.

(self)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 4

add_inputMethod · 0.80
_read_replyMethod · 0.80
get_outputMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected