Skip to content

Commit

Permalink
'%q' formatting now is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Mar 6, 2025
1 parent 74129cc commit da44937
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
6 changes: 0 additions & 6 deletions py-polars/tests/unit/datatypes/test_temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,12 +1753,6 @@ def test_to_string_invalid_format() -> None:
ComputeError, match="cannot format timezone-naive Datetime with format '%z'"
):
tz_naive.dt.to_string("%z")
with pytest.raises(
ComputeError, match="cannot format timezone-aware Datetime with format '%q'"
):
tz_naive.dt.replace_time_zone("UTC").dt.to_string("%q")
with pytest.raises(ComputeError, match="cannot format Date with format '%q'"):
tz_naive.dt.date().dt.to_string("%q")


def test_tz_aware_to_string() -> None:
Expand Down
11 changes: 0 additions & 11 deletions py-polars/tests/unit/io/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,17 +1299,6 @@ def test_datetime_format(fmt: str, expected: str) -> None:
assert csv == expected


def test_invalid_datetime_format() -> None:
tz_naive = pl.Series(["2020-01-01T00:00:00"]).str.strptime(pl.Datetime)
tz_aware = tz_naive.dt.replace_time_zone("UTC")
with pytest.raises(
ComputeError, match="cannot format NaiveDateTime with format '%q'"
):
tz_naive.to_frame().write_csv(datetime_format="%q")
with pytest.raises(ComputeError, match="cannot format DateTime with format '%q'"):
tz_aware.to_frame().write_csv(datetime_format="%q")


@pytest.mark.parametrize(
("fmt", "expected"),
[
Expand Down

0 comments on commit da44937

Please sign in to comment.