Skip to content

Commit

Permalink
extra coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Mar 11, 2024
1 parent d1025ff commit 2377d26
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions py-polars/tests/unit/datatypes/test_temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from polars.datatypes import DATETIME_DTYPES, DTYPE_TEMPORAL_UNITS, TEMPORAL_DTYPES
from polars.exceptions import (
ComputeError,
InvalidOperationError,
PolarsInefficientMapWarning,
TimeZoneAwareConstructorWarning,
)
Expand Down Expand Up @@ -1670,6 +1671,16 @@ def test_replace_time_zone_sortedness_expressions(
assert result["ts"].flags["SORTED_ASC"] == expected_sortedness


def test_invalid_ambiguous_value_in_expression() -> None:
df = pl.DataFrame(
{"a": [datetime(2020, 10, 25, 1)] * 2, "b": ["earliest", "cabbage"]}
)
with pytest.raises(InvalidOperationError, match="Invalid argument cabbage"):
df.select(
pl.col("a").dt.replace_time_zone("Europe/London", ambiguous=pl.col("b"))
)


def test_replace_time_zone_ambiguous_null() -> None:
df = pl.DataFrame(
{
Expand Down

0 comments on commit 2377d26

Please sign in to comment.