@@ -1007,6 +1007,28 @@ def side_effect(line):
10071007 prompts = [o for o in outputs if 'prompt' in o ]
10081008 self .assertEqual (len (prompts ), 2 ) # Should have sent 2 prompts
10091009
1010+ def test_expression_evaluation_output (self ):
1011+ """Test that expression evaluation results are sent through the socket, not to debuggee stdout."""
1012+ # Test lambda expression
1013+ self .pdb .default ("(lambda: 123)()" )
1014+
1015+ outputs = self .sockfile .get_output ()
1016+ # Should have a message with the result
1017+ messages = [o for o in outputs if 'message' in o ]
1018+ self .assertTrue (any ('123' in o .get ('message' , '' ) for o in messages ),
1019+ f"Expected '123' in output messages, got: { messages } " )
1020+
1021+ def test_expression_evaluation_sum (self ):
1022+ """Test that sum expression evaluation results are sent through the socket."""
1023+ # Test sum expression
1024+ self .pdb .default ("sum(i for i in (1, 2, 3))" )
1025+
1026+ outputs = self .sockfile .get_output ()
1027+ # Should have a message with the result
1028+ messages = [o for o in outputs if 'message' in o ]
1029+ self .assertTrue (any ('6' in o .get ('message' , '' ) for o in messages ),
1030+ f"Expected '6' in output messages, got: { messages } " )
1031+
10101032
10111033@requires_subprocess ()
10121034@unittest .skipIf (is_wasi , "WASI does not support TCP sockets" )
0 commit comments