mirror of
https://github.com/apache/superset.git
synced 2026-07-18 20:55:47 +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:
@@ -77,6 +77,11 @@ def mock_query() -> MagicMock:
|
||||
return query
|
||||
|
||||
|
||||
def _passthrough_mutate_sql_based_on_config(sql: str, **kwargs: Any) -> str:
|
||||
"""Mirror the real `Database.mutate_sql_based_on_config` no-op default."""
|
||||
return sql
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_database() -> MagicMock:
|
||||
"""Create a mock Database."""
|
||||
@@ -97,7 +102,9 @@ def mock_database() -> MagicMock:
|
||||
# Mirrors the real `Database.mutate_sql_based_on_config` default (no-op
|
||||
# when no `SQL_QUERY_MUTATOR` is configured), so SQL parsed from its
|
||||
# return value stays valid instead of an un-parseable `MagicMock`.
|
||||
database.mutate_sql_based_on_config = MagicMock(side_effect=lambda sql, **kw: sql)
|
||||
database.mutate_sql_based_on_config = MagicMock(
|
||||
side_effect=_passthrough_mutate_sql_based_on_config
|
||||
)
|
||||
return database
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user