Skip to content

Commit

Permalink
replace ValueError with TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Harbeck committed Aug 26, 2024
1 parent 80a7e27 commit a46f63f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions py-polars/polars/expr/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -2583,8 +2583,8 @@ def replace_many(
""" # noqa: W505
if replace_with is no_default:
if not isinstance(patterns, Mapping):
msg = "`replace_with` is required if `patterns` is not a Mapping type"
raise ValueError(msg)
msg = "`replace_with` argument is required if `patterns` argument is not a Mapping type"
raise TypeError(msg)
# Early return in case of an empty mapping.
if not patterns:
return wrap_expr(self._pyexpr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ def test_replace_many_invalid_inputs() -> None:
with pytest.raises(SchemaError):
df.select(pl.col("text").str.replace_many(["me"], None))

with pytest.raises(ValueError):
with pytest.raises(TypeError):
df.select(pl.col("text").str.replace_many(["me"]))

with pytest.raises(
Expand All @@ -1138,7 +1138,7 @@ def test_replace_many_invalid_inputs() -> None:
with pytest.raises(SchemaError):
df.select(pl.col("text").str.replace_many(["me"], None))

with pytest.raises(ValueError):
with pytest.raises(TypeError):
df.select(pl.col("text").str.replace_many(["me"]))

with pytest.raises(
Expand Down

0 comments on commit a46f63f

Please sign in to comment.