bito-code-review[bot] commented on PR #42087:
URL: https://github.com/apache/superset/pull/42087#issuecomment-5012955099
<!-- Bito Reply -->
The flagged issue is correct. In
`test_get_sqla_col_falls_back_when_stored_expression_unparseable`, the test
patches `validate_adhoc_subquery` but does not verify that it was actually
called. This means the test could pass even if the call to
`_validate_stored_expression` (which invokes the validator) were accidentally
removed from `get_sqla_col`, as `literal_column` would still receive the raw
expression. To resolve this, you should capture the patch as a spy and assert
that it was called.
Would you like me to implement this fix for you? If so, I can also check the
other comments on this PR and apply fixes for them as well.
**tests/unit_tests/connectors/sqla/models_test.py**
```
spy = mocker.patch(
"superset.models.helpers.validate_adhoc_subquery",
side_effect=SupersetParseError("DATE_ADD(ds, 1)", "mysql"),
)
literal = mocker.patch("superset.connectors.sqla.models.literal_column")
tc.get_sqla_col()
# The raw expression reaches ``literal_column`` unchanged; no exception.
assert literal.call_args.args[0] == "DATE_ADD(ds, 1)"
spy.assert_called_once()
```
--
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]