chore: remove bare excepts

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 867666149
This commit is contained in:
George Weale
2026-02-09 10:25:03 -08:00
committed by Copybara-Service
parent fd8a9e3962
commit 0758f877b1
17 changed files with 253 additions and 22 deletions
@@ -1136,6 +1136,33 @@ def test_execute_sql_result_dtype(
assert result == {"status": "SUCCESS", "rows": tool_result_rows}
@mock.patch.dict(os.environ, {}, clear=True)
@mock.patch.object(bigquery.Client, "query_and_wait", autospec=True)
@mock.patch.object(bigquery.Client, "query", autospec=True)
def test_execute_sql_result_dtype_circular_reference(
mock_query, mock_query_and_wait
):
"""Test execute_sql converts circular values to strings."""
credentials = mock.create_autospec(Credentials, instance=True)
tool_settings = BigQueryToolConfig()
tool_context = mock.create_autospec(ToolContext, instance=True)
query_job = mock.create_autospec(bigquery.QueryJob)
query_job.statement_type = "SELECT"
mock_query.return_value = query_job
circular_value = []
circular_value.append(circular_value)
mock_query_and_wait.return_value = [{"x": circular_value}]
result = query_tool.execute_sql(
"my_project", "SELECT 1", credentials, tool_settings, tool_context
)
assert result == {
"status": "SUCCESS",
"rows": [{"x": str(circular_value)}],
}
@mock.patch.object(bq_client_lib, "get_bigquery_client", autospec=True)
def test_execute_sql_bq_client_creation(mock_get_bigquery_client):
"""Test BigQuery client creation params during execute_sql tool invocation."""