Skip to content

Commit

Permalink
additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Jun 9, 2024
1 parent da5414e commit 675cca5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion py-polars/polars/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def __repr__(self) -> str:
else:
str_params = ", ".join(
(repr(v)[1:-1] if k.startswith("*") else f"{k}={v!r}")
for k, v in (params or {}).items()
for k, v in params.items()
).rstrip(",")
return f"cs.{selector_name}({str_params})"

Expand Down
22 changes: 13 additions & 9 deletions py-polars/tests/unit/test_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,15 +665,19 @@ def test_selector_sets(df: pl.DataFrame) -> None:
}

# exclusive or
assert df.select((cs.matches("e|g")) ^ cs.numeric()).schema == OrderedDict(
{
"abc": pl.UInt16,
"bbb": pl.UInt32,
"eee": pl.Boolean,
"fgg": pl.Boolean,
"ghi": pl.Time,
}
)
for selected in (
df.select((cs.matches("e|g")) ^ cs.numeric()),
df.select((cs.contains("b", "g")) ^ pl.col("eee")),
):
assert selected.schema == OrderedDict(
{
"abc": pl.UInt16,
"bbb": pl.UInt32,
"eee": pl.Boolean,
"fgg": pl.Boolean,
"ghi": pl.Time,
}
)


def test_selector_dispatch_default_operator() -> None:
Expand Down

0 comments on commit 675cca5

Please sign in to comment.