Skip to content

Commit

Permalink
Fix tests for error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Dec 23, 2023
1 parent 083fbef commit 7f67c78
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion py-polars/tests/unit/io/test_lazy_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_lazy_row_count_no_push_down(foods_file_path: Path) -> None:
# related to row count is not pushed.
assert 'FILTER [(col("row_nr")) == (1)] FROM' in plan
# unrelated to row count is pushed.
assert 'SELECTION: [(col("category")) == (Utf8(vegetables))]' in plan
assert 'SELECTION: [(col("category")) == (String(vegetables))]' in plan


@pytest.mark.write_disk()
Expand Down
4 changes: 2 additions & 2 deletions py-polars/tests/unit/operations/test_is_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_is_in_series() -> None:

with pytest.raises(
pl.InvalidOperationError,
match=r"`is_in` cannot check for Utf8 values in Int64 data",
match=r"`is_in` cannot check for String values in Int64 data",
):
df.select(pl.col("b").is_in(["x", "x"]))

Expand Down Expand Up @@ -197,7 +197,7 @@ def test_is_in_float(dtype: pl.PolarsDataType) -> None:
(
pl.DataFrame({"a": ["1", "2"], "b": [[1, 2], [3, 4]]}),
None,
r"`is_in` cannot check for Utf8 values in List\(Int64\) data",
r"`is_in` cannot check for String values in List\(Int64\) data",
),
(
pl.DataFrame({"a": [date.today(), None], "b": [[1, 2], [3, 4]]}),
Expand Down
4 changes: 3 additions & 1 deletion py-polars/tests/unit/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ def test_not_found_error() -> None:


def test_string_numeric_comp_err() -> None:
with pytest.raises(pl.ComputeError, match="cannot compare utf-8 with numeric data"):
with pytest.raises(
pl.ComputeError, match="cannot compare string with numeric data"
):
pl.DataFrame({"a": [1.1, 21, 31, 21, 51, 61, 71, 81]}).select(pl.col("a") < "9")


Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/test_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ def test_repr_long_expression() -> None:
result = repr(expr).split("0x")[0]

# note the … denoting that there was truncated text
expected = "<Expr ['dtype_columns([Utf8]).str.coun…'] at "
expected = "<Expr ['dtype_columns([String]).str.co…'] at "
assert result == expected
assert repr(expr).endswith(">")

Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/test_serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_pickle_udf_expression() -> None:
# tests that 'GetOutput' is also deserialized
with pytest.raises(
pl.SchemaError,
match=r"expected output type 'Utf8', got 'Int64'; set `return_dtype` to the proper datatype",
match=r"expected output type 'String', got 'Int64'; set `return_dtype` to the proper datatype",
):
df.select(e)

Expand Down

0 comments on commit 7f67c78

Please sign in to comment.