mirror of
https://github.com/apache/superset.git
synced 2026-07-18 04:35:40 +00:00
fix(sql-lab): address minor type-hint nits from codeant review
Add explicit type annotations for the `blocks` list in sql_lab.py and the mock/cursor test variables, and replace an untyped lambda mutator with a typed helper to keep MUTATE_AFTER_SPLIT type-hint coverage consistent with the rest of the PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -47,7 +47,11 @@ from superset.models.core import Database
|
||||
|
||||
# Note: database, database_with_dml, mock_db_session fixtures and
|
||||
# mock_query_execution helper are imported from conftest.py
|
||||
from .conftest import create_mock_cursor, mock_query_execution
|
||||
from .conftest import (
|
||||
_passthrough_mutate_sql_based_on_config,
|
||||
create_mock_cursor,
|
||||
mock_query_execution,
|
||||
)
|
||||
|
||||
# =============================================================================
|
||||
# Basic Execution Tests
|
||||
@@ -889,14 +893,16 @@ def test_execute_sql_with_cursor_forwards_is_split(
|
||||
"""
|
||||
from superset.sql.execution.executor import execute_sql_with_cursor
|
||||
|
||||
mutate_mock = mocker.patch.object(
|
||||
database, "mutate_sql_based_on_config", side_effect=lambda sql, **kw: sql
|
||||
mutate_mock: MagicMock = mocker.patch.object(
|
||||
database,
|
||||
"mutate_sql_based_on_config",
|
||||
side_effect=_passthrough_mutate_sql_based_on_config,
|
||||
)
|
||||
mocker.patch.object(database.db_engine_spec, "execute")
|
||||
mocker.patch.object(database.db_engine_spec, "fetch_data", return_value=[(1,)])
|
||||
mocker.patch("superset.result_set.SupersetResultSet", return_value=MagicMock())
|
||||
|
||||
cursor = create_mock_cursor(["id"], data=[(1,)])
|
||||
cursor: MagicMock = create_mock_cursor(["id"], data=[(1,)])
|
||||
|
||||
execute_sql_with_cursor(
|
||||
database=database,
|
||||
|
||||
Reference in New Issue
Block a user