sadpandajoe opened a new pull request, #46067:
URL: https://github.com/apache/superset/pull/46067

   ### SUMMARY
   The nightly full-repo `pre-commit` run fails `mypy (main)` with four errors 
in `tests/unit_tests/sql/execution/`. Those assertions came in with #45993: 
they call `.equals()` / `.to_dict()` on `StatementResult.data` and use `in` on 
`QueryResult.error_message`. Both fields are Optional in `superset-core` 
(`data: pd.DataFrame | None`, `error_message: str | None`), and the tests never 
narrow them.
   
   The PR-level mypy run did not catch this. It only checks the changed files, 
so `superset_core` is not on the mypy command line and those types resolve to 
`Any` under `ignore_missing_imports`. The nightly `--all-files` run does 
include `superset-core`, sees the real Optional types, and fails.
   
   This PR adds an `assert ... is not None` before each of the four uses. These 
tests already use that pattern for the same fields elsewhere. The product code 
and the `superset-core` types are unchanged; `None` is a valid value for both 
fields (DML statements, successful queries). If a field were ever `None`, the 
test would now fail with a clear assertion instead of an 
`AttributeError`/`TypeError`.
   
   ### TESTING INSTRUCTIONS
   1. Run `pre-commit run mypy --files 
tests/unit_tests/sql/execution/test_executor.py 
tests/unit_tests/sql/execution/test_query_history.py 
superset-core/src/superset_core/queries/types.py`. Before this change it 
reports 4 errors (`test_executor.py:648`, `test_query_history.py:372`, `:688`, 
`:793`); with it, `mypy (main)` passes.
   2. Run `pytest tests/unit_tests/sql/execution/test_executor.py 
tests/unit_tests/sql/execution/test_query_history.py`. All tests still pass.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: Fixes #46066
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] test(s... sadpandajoe (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... codecov[bot] (via GitHub) via notifications

Reply via email to