aminghadersohi commented on code in PR #41923:
URL: https://github.com/apache/superset/pull/41923#discussion_r3627292033
##########
tests/unit_tests/mcp_service/dataset/test_dataset_schemas.py:
##########
@@ -52,3 +55,15 @@ def test_get_dataset_info_select_columns_columns_alias(self)
-> None:
def test_list_datasets_select_columns_columns_alias(self) -> None:
req = ListDatasetsRequest.model_validate({"columns": ["id",
"table_name"]})
assert req.select_columns == ["id", "table_name"]
+
+ def test_list_datasets_search_and_filters_conflict_validation(self) ->
None:
+ """search and filters are mutually exclusive on ListDatasetsRequest,
+ inherited from PaginatedListRequest.validate_search_and_filters."""
+ with pytest.raises(
+ ValueError,
+ match="Cannot use both 'search' and 'filters' parameters
simultaneously",
+ ):
Review Comment:
Not valid — no change needed. In Pydantic v2, `ValidationError` **is** a
subclass of `ValueError`, so `pytest.raises(ValueError)` catches it:
```python
>>> import pydantic; pydantic.VERSION
'2.11.7' # version pinned in this repo
>>> from pydantic_core import ValidationError
>>> issubclass(ValidationError, ValueError)
True
```
The test passes as written:
```
tests/unit_tests/mcp_service/dataset/test_dataset_schemas.py::TestRequestSchemaAliasChoices::test_list_datasets_search_and_filters_conflict_validation
PASSED
```
It also deliberately mirrors the identical, long-standing assertion pattern
for the same shared validator in the sibling suites
(`chart/tool/test_list_charts.py::test_search_and_filters_conflict_validation`,
plus theme/query/saved_query), all of which pass in CI. Switching only this one
to `ValidationError` would break consistency with those tests for no behavioral
gain.
--
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]