From 4e8d0e0abe5de8f12afaf63e8a6b89583e920f4d Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 7 Jul 2026 19:01:01 -0700 Subject: [PATCH] test: add type hints to new orderby jinja test Co-Authored-By: Claude Opus 4.8 --- .../db_engine_specs/base_engine_spec_tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py b/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py index 22032b754ec..4cb60efc7b3 100644 --- a/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py +++ b/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. import datetime +from typing import cast from unittest import mock import pytest @@ -31,6 +32,7 @@ from superset.db_engine_specs.odps import OdpsBaseEngineSpec, OdpsEngineSpec from superset.db_engine_specs.sqlite import SqliteEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.sql.parse import Table +from superset.superset_typing import QueryObjectDict from superset.utils.database import get_example_database from tests.integration_tests.base_tests import SupersetTestCase from tests.integration_tests.test_app import app @@ -204,7 +206,7 @@ class SupersetTestCases(SupersetTestCase): @mock.patch("superset.models.core.Database.db_engine_spec", BaseEngineSpec) @pytest.mark.usefixtures("load_birth_names_dashboard_with_slices") - def test_jinja_calculated_column_in_order_by(self): + def test_jinja_calculated_column_in_order_by(self) -> None: """ A calculated column referenced by a SIMPLE adhoc metric in `orderby` should have its Jinja template rendered, the same way it is for @@ -240,7 +242,7 @@ class SupersetTestCases(SupersetTestCase): ] ], } - sql = table.get_query_str(query_obj) + sql = table.get_query_str(cast(QueryObjectDict, query_obj)) orderby_clause = sql.split("ORDER BY")[1] assert "{%" not in orderby_clause assert "{{" not in orderby_clause