Copilot commented on code in PR #45268:
URL: https://github.com/apache/superset/pull/45268#discussion_r4276421331
##########
tests/unit_tests/semantic_layers/metric_filter_test.py:
##########
@@ -245,9 +245,10 @@ def
test_incompatible_filter_is_reported_without_breaking_chart(
assert result["rejected_filters"][0]["column"] == column
assert result["applied_filters"] == ([{"column": "category"}] if mixed
else [])
query: SemanticQuery = metric_view[1].get_table.call_args.args[0]
- assert {f.column.name for f in query.filters if f.column} == (
- {"category"} if mixed else set()
- )
+ assert query.filters is not None
+ assert {
+ f.column.name for f in query.filters if isinstance(f, Filter) and
f.column
Review Comment:
`SemanticQuery.filters` is typed as optional, and this test asserts it is
non-`None` unconditionally. If the code under test legitimately sets
`filters=None` when `mixed` is false (or when no filters are applied), this
will fail even though the expected result is an empty set. Prefer handling the
optional value directly (e.g., iterate over `query.filters or set()`), or make
the non-`None` assertion conditional on the scenario that guarantees filters
are present.
--
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]