@@ -1146,20 +1146,22 @@ mod tests {
11461146 use super :: * ;
11471147
11481148 #[ test]
1149- fn test_create_agent_wrapper ( ) {
1149+ fn test_create_agent_wrapper_no_modification ( ) {
1150+ // Wrapper no longer modifies code to preserve `from __future__` imports
11501151 let code = r#"
11511152class MyAgent(Agent):
11521153 def solve(self, req):
11531154 return Response.cmd("ls")
11541155"# ;
11551156 let wrapped = create_agent_wrapper ( code) ;
1156- assert ! ( wrapped . contains ( "if __name__" ) ) ;
1157- assert ! ( wrapped. contains ( "agent_class" ) ) ;
1157+ // Code should be returned as-is
1158+ assert_eq ! ( wrapped, code ) ;
11581159 }
11591160
11601161 #[ test]
1161- fn test_wrapper_preserves_existing_entry ( ) {
1162- let code = r#"
1162+ fn test_wrapper_preserves_future_imports ( ) {
1163+ let code = r#"from __future__ import annotations
1164+
11631165class MyAgent(Agent):
11641166 def solve(self, req):
11651167 return Response.cmd("ls")
@@ -1168,11 +1170,8 @@ if __name__ == "__main__":
11681170 run(MyAgent())
11691171"# ;
11701172 let wrapped = create_agent_wrapper ( code) ;
1171- // Should add HTTP mode setup but preserve existing entry point
1172- assert ! ( wrapped. contains( "FORCE_HTTP_SERVER" ) ) ;
1173- assert ! ( wrapped. contains( "if __name__" ) ) ;
1174- assert ! ( wrapped. contains( "run(MyAgent())" ) ) ;
1175- // Should not add auto-generated entry point since one exists
1176- assert ! ( !wrapped. contains( "Auto-generated entry point" ) ) ;
1173+ // Code should be returned as-is, preserving the future import at the start
1174+ assert_eq ! ( wrapped, code) ;
1175+ assert ! ( wrapped. starts_with( "from __future__" ) ) ;
11771176 }
11781177}
0 commit comments