bito-code-review[bot] commented on PR #42595:
URL: https://github.com/apache/superset/pull/42595#issuecomment-5125070340
<!-- Bito Reply -->
The flagged issue is correct. In the current test implementation,
`get_sqla_query` applies the filter `{'col': 'b', 'op': 'IN', 'val':
['Alice']}` as an outer `WHERE` clause to the generated query. Consequently,
the assertion `assert "'Alice'" in sql` passes regardless of whether the inner
Jinja template `filter_values('b')` correctly resolved the filter. To make this
a robust regression test, you should inspect the subquery specifically or use a
dataset that would return different results if the inner filter were missing.
To resolve this, you can modify the test to assert that the inner SQL
contains the filtered value, or use a mock/spy to verify that `filter_values`
was called with the expected arguments. Since there are no other comments in
this PR, no further actions are required.
**tests/unit_tests/models/helpers_test.py**
```
# Instead of checking the outer SQL, inspect the virtual dataset's subquery:
subquery = result.sqla_query.froms[0]
subquery_sql = str(subquery.compile(dialect=engine.dialect,
compile_kwargs={"literal_binds": True}))
assert "'Alice'" in subquery_sql, "Inner virtual dataset SQL must
contain the filter."
```
--
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]