@@ -90,9 +90,7 @@ async def test_execute_sql_programming_error(self, executor):
9090 with patch ("app.services.database.create_database_manager" ) as mock_create_db :
9191 mock_db = MagicMock ()
9292 mock_db .execute_query = MagicMock (
93- side_effect = ProgrammingError (
94- "syntax error" , None , None
95- )
93+ side_effect = ProgrammingError ("syntax error" , None , None )
9694 )
9795 mock_create_db .return_value = mock_db
9896
@@ -109,9 +107,7 @@ async def test_execute_sql_value_error(self, executor):
109107 """Test SQL execution with ValueError (validation error)"""
110108 with patch ("app.services.database.create_database_manager" ) as mock_create_db :
111109 mock_db = MagicMock ()
112- mock_db .execute_query = MagicMock (
113- side_effect = ValueError ("Read-only check failed" )
114- )
110+ mock_db .execute_query = MagicMock (side_effect = ValueError ("Read-only check failed" ))
115111 mock_create_db .return_value = mock_db
116112
117113 result , count = await executor .execute_sql (
@@ -152,9 +148,7 @@ async def test_inject_sql_data_custom_variable_name(self, executor):
152148 sql = "SELECT * FROM users"
153149 data = [{"id" : 1 }]
154150
155- code = await executor .inject_sql_data (
156- sql , data , variable_name = "custom_var"
157- )
151+ code = await executor .inject_sql_data (sql , data , variable_name = "custom_var" )
158152
159153 assert "custom_var" in code
160154 assert isinstance (code , str )
@@ -194,10 +188,7 @@ async def test_execute_safe_code(self, sandbox):
194188 mock_runtime .inject_sql_data = MagicMock ()
195189 mock_runtime_class .return_value = mock_runtime
196190
197- with patch .object (
198- sandbox , "_execute_with_timeout" ,
199- return_value = ("3" , [])
200- ):
191+ with patch .object (sandbox , "_execute_with_timeout" , return_value = ("3" , [])):
201192 output , images = await sandbox .execute (safe_code )
202193
203194 assert output == "3"
@@ -260,8 +251,7 @@ async def test_execute_with_sql_data(self, sandbox):
260251 mock_runtime_class .return_value = mock_runtime
261252
262253 with patch .object (
263- sandbox , "_execute_with_timeout" ,
264- return_value = ("[{'id': 1}]" , [])
254+ sandbox , "_execute_with_timeout" , return_value = ("[{'id': 1}]" , [])
265255 ):
266256 output , images = await sandbox .execute (code , sql_data = sql_data )
267257
@@ -373,7 +363,9 @@ async def test_extract_results_malformed_response(self, processor):
373363 with patch ("app.services.engine_content.extract_sql_block" , return_value = None ):
374364 with patch ("app.services.engine_content.extract_python_block" , return_value = None ):
375365 with patch ("app.services.engine_content.extract_chart_config" , return_value = None ):
376- with patch ("app.services.engine_content.parse_thinking_markers" , return_value = []):
366+ with patch (
367+ "app.services.engine_content.parse_thinking_markers" , return_value = []
368+ ):
377369 result = await processor .extract_results (ai_content )
378370
379371 assert result ["sql_code" ] is None
@@ -397,7 +389,6 @@ async def test_extract_chart_config_valid(self, processor):
397389 "yKeys" : ["revenue" ],
398390 }
399391
400-
401392 await processor .extract_results (ai_content )
402393
403394 # Since extract_chart_config is mocked, verify the mock is set up
@@ -423,7 +414,9 @@ def test_build_chart_payload(self, processor):
423414 "data" : data ,
424415 }
425416
426- with patch ("app.services.engine_visualization.build_chart_from_config" , return_value = expected_chart ):
417+ with patch (
418+ "app.services.engine_visualization.build_chart_from_config" , return_value = expected_chart
419+ ):
427420 result = processor .build_chart_payload (chart_config , data )
428421
429422 assert result is not None
0 commit comments