Test registering breakpoint commands.
(self)
| 938 | mock_error.assert_called_once() |
| 939 | |
| 940 | def test_registering_commands(self): |
| 941 | """Test registering breakpoint commands.""" |
| 942 | # Mock get_bpbynumber |
| 943 | with unittest.mock.patch.object(self.pdb, 'get_bpbynumber'): |
| 944 | # Queue up some input to send |
| 945 | self.sockfile.add_input({"reply": "commands 1"}) |
| 946 | self.sockfile.add_input({"reply": "silent"}) |
| 947 | self.sockfile.add_input({"reply": "print('hi')"}) |
| 948 | self.sockfile.add_input({"reply": "end"}) |
| 949 | self.sockfile.add_input({"signal": "EOF"}) |
| 950 | |
| 951 | # Run the PDB command loop |
| 952 | self.pdb.cmdloop() |
| 953 | |
| 954 | outputs = self.sockfile.get_output() |
| 955 | self.assertIn('command_list', outputs[0]) |
| 956 | self.assertEqual(outputs[1], {"prompt": "(Pdb) ", "state": "pdb"}) |
| 957 | self.assertEqual(outputs[2], {"prompt": "(com) ", "state": "commands"}) |
| 958 | self.assertEqual(outputs[3], {"prompt": "(com) ", "state": "commands"}) |
| 959 | self.assertEqual(outputs[4], {"prompt": "(com) ", "state": "commands"}) |
| 960 | self.assertEqual(outputs[5], {"prompt": "(Pdb) ", "state": "pdb"}) |
| 961 | self.assertEqual(outputs[6], {"message": "\n", "type": "info"}) |
| 962 | self.assertEqual(len(outputs), 7) |
| 963 | |
| 964 | self.assertEqual( |
| 965 | self.pdb.commands[1], |
| 966 | ["_pdbcmd_silence_frame_status", "print('hi')"], |
| 967 | ) |
| 968 | |
| 969 | def test_detach(self): |
| 970 | """Test the detach method.""" |
nothing calls this directly
no test coverage detected