diff --git a/tests/test_query.py b/tests/test_query.py index b9dcbc6f8e..5fde811450 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -397,3 +397,8 @@ def compose(self) -> ComposeResult: assert isinstance(app.query_one_optional("Input"), Input) assert isinstance(app.query_one_optional(".bar"), Input) + + # Verify that WrongType exceptions still propagate + with pytest.raises(WrongType): + # Asking for a Label, but the widget is an Input + app.query_one_optional("#foo", Label)