You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jl...@apache.org on 2026/10/20 08:47:39 UTC
(superset) 01/01: fix(tests): narrow Optional StatementResult.data in async result tests
This is an automated email from the ASF dual-hosted git repository.
sadpandajoe pushed a commit to branch ultraset-async-results-test-optional-data-mypy
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 766dde075427fd6d0690de02ab1581831ff5e646
Author: Joe Li <47...@users.noreply.github.com>
AuthorDate: Tue Oct 20 08:47:21 2026 +0000
fix(tests): narrow Optional StatementResult.data in async result tests
StatementResult.data is typed `pd.DataFrame | None` in superset-core
(None for DML statements). Two assertions added in #45348 index it
straight off SQLExecutor.execute()/execute_async().get_result(), which
mypy flags as `Value of type "Any | None" is not indexable` whenever
superset-core sources are part of the run (the nightly --all-files
pre-commit job). Assert the data is present before indexing, matching
the existing pattern in this module.
Co-Authored-By: Claude Opus 5.5 <no...@anthropic.com>
---
tests/unit_tests/sql/execution/test_async_results.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/unit_tests/sql/execution/test_async_results.py b/tests/unit_tests/sql/execution/test_async_results.py
index 995f71a8357..40e66ccb4ab 100644
--- a/tests/unit_tests/sql/execution/test_async_results.py
+++ b/tests/unit_tests/sql/execution/test_async_results.py
@@ -752,6 +752,7 @@ def test_legacy_cache_without_column_metadata_preserves_values(
)
assert result.status == QueryStatus.SUCCESS, result.error_message
assert result.is_cached
+ assert result.statements[0].data is not None
assert result.statements[0].data["id"].tolist() == [value, None]
pd.testing.assert_frame_equal(
result.statements[0].data,
@@ -891,6 +892,7 @@ def test_corrupt_cache_is_a_miss(
result = executor.execute(sql)
assert result.status == QueryStatus.SUCCESS, result.error_message
assert not result.is_cached
+ assert result.statements[0].data is not None
assert result.statements[0].data["value"].tolist() == [1]