Skip to content

Commit 109537c

Browse files
committed
test: cover error in meta.as_selector
#3233 (comment)
1 parent 19ca6d3 commit 109537c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/plan/selectors_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from narwhals import _plan as nwp
1616
from narwhals._plan import Expr, Selector, selectors as ncs
1717
from narwhals._utils import zip_strict
18-
from narwhals.exceptions import ColumnNotFoundError
19-
from tests.plan.utils import Frame, assert_expr_ir_equal, named_ir
18+
from narwhals.exceptions import ColumnNotFoundError, InvalidOperationError
19+
from tests.plan.utils import Frame, assert_expr_ir_equal, named_ir, re_compile
2020

2121
if TYPE_CHECKING:
2222
from collections.abc import Iterable
@@ -429,6 +429,11 @@ def test_selector_expansion() -> None:
429429
s = s & s2e.meta.as_selector()
430430
df.assert_selects(s, "b", "c")
431431

432+
with pytest.raises(
433+
InvalidOperationError, match=re_compile(r"cannot turn.+max.+into a selector")
434+
):
435+
nwp.col("a").max().meta.as_selector()
436+
432437

433438
def test_selector_sets(schema_non_nested: nw.Schema, schema_mixed: nw.Schema) -> None:
434439
df = Frame(schema_non_nested)

0 commit comments

Comments
 (0)