bito-code-review[bot] commented on PR #40224:
URL: https://github.com/apache/superset/pull/40224#issuecomment-4479173596
<!-- Bito Reply -->
The PR comment suggests that the regression test for Jinja rendering in
virtual datasets is incomplete. The test currently verifies that the
`get_columns_description` function returns the expected column list but does
not check whether it was called with the rendered SQL. To fix this, you should
capture the mock and assert that it was called with `rendered_sql` as the query
argument. Here's how you can implement the fix concisely in
`tests/unit_tests/connectors/sqla/utils_test.py`:
**tests/unit_tests/connectors/sqla/utils_test.py**
```
mocker.patch(
"superset.connectors.sqla.utils.get_columns_description",
return_value=[{"name": "rendered_col", "type": "INTEGER"}],
new_callable=mocker.MagicMock
)
# ... existing test code ...
# Add this assertion to verify the rendered SQL is used
get_columns_description_mock = mocker.patch(
"superset.connectors.sqla.utils.get_columns_description",
return_value=[{"name": "rendered_col", "type": "INTEGER"}],
new_callable=mocker.MagicMock
)
assert get_columns_description_mock.call_args[1]["query"] == rendered_sql
```
--
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]