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

Method test_help_system

Lib/test/test_remote_pdb.py:1347–1384  ·  view source on GitHub ↗

Test that the help system properly sends help text to the client.

(self)

Source from the content-addressed store, hash-verified

1345 self.assertEqual(process.returncode, 0)
1346
1347 def test_help_system(self):
1348 """Test that the help system properly sends help text to the client."""
1349 self._create_script()
1350 process, client_file = self._connect_and_get_client_file()
1351
1352 with kill_on_error(process):
1353 # Skip initial messages until we get to the prompt
1354 self._read_until_prompt(client_file)
1355
1356 # Request help for different commands
1357 help_commands = ["help", "help break", "help continue", "help pdb"]
1358
1359 for cmd in help_commands:
1360 self._send_command(client_file, cmd)
1361
1362 # Look for help message
1363 data = client_file.readline()
1364 message = json.loads(data.decode())
1365
1366 self.assertIn('help', message)
1367
1368 if cmd == "help":
1369 # Should just contain the command itself
1370 self.assertEqual(message['help'], "")
1371 else:
1372 # Should contain the specific command we asked for help with
1373 command = cmd.split()[1]
1374 self.assertEqual(message['help'], command)
1375
1376 # Skip to the next prompt
1377 self._read_until_prompt(client_file)
1378
1379 # Continue execution to finish the program
1380 self._send_command(client_file, "c")
1381
1382 stdout, stderr = process.communicate(timeout=SHORT_TIMEOUT)
1383 self.assertIn("Function returned: 42", stdout)
1384 self.assertEqual(process.returncode, 0)
1385
1386 def test_multi_line_commands(self):
1387 """Test that multi-line commands work properly over remote connection."""

Callers

nothing calls this directly

Calls 12

_create_scriptMethod · 0.95
_read_until_promptMethod · 0.95
_send_commandMethod · 0.95
assertInMethod · 0.80
kill_on_errorFunction · 0.70
readlineMethod · 0.45
loadsMethod · 0.45
decodeMethod · 0.45
assertEqualMethod · 0.45
splitMethod · 0.45
communicateMethod · 0.45

Tested by

no test coverage detected