-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Invalid selectors not being recognized #19136
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19136 +/- ##
==========================================
- Coverage 79.78% 79.76% -0.03%
==========================================
Files 1531 1531
Lines 208427 208446 +19
Branches 2913 2913
==========================================
- Hits 166295 166262 -33
- Misses 41581 41633 +52
Partials 551 551 ☔ View full report in Codecov by Sentry. |
def test_invalid_selector() -> None: | ||
df = pl.DataFrame(data={"x": [1, 2], "z": ["a", "b"]}) | ||
with pytest.raises(InvalidOperationError, match="invalid selector expression"): | ||
df.drop(pl.col("x", "z") + 2) # type: ignore[arg-type] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whys does mypy complain here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❯ mypy py-polars/tests/unit/test_selectors.py
py-polars/tests/unit/test_selectors.py:822: error: Argument 1 to "drop" of "DataFrame" has incompatible type "Expr"; expected "str | _selector_proxy_ | Iterable[str | _selector_proxy_]" [arg-type]
py-polars/tests/unit/test_selectors.py:824: error: Argument 1 to "drop" of "DataFrame" has incompatible type "Expr"; expected "str | _selector_proxy_ | Iterable[str | _selector_proxy_]" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I think we must pass a seelctor
as we don't allow expression inputs here.
Closes #19023