From add7beafc8394ae76309bcb93443aee840d8e5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 6 May 2025 07:12:45 +0200 Subject: [PATCH] test: make `polars` optional in `truncate_test` --- tests/expr_and_series/dt/truncate_test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/expr_and_series/dt/truncate_test.py b/tests/expr_and_series/dt/truncate_test.py index 3e51a796..d2a2e960 100644 --- a/tests/expr_and_series/dt/truncate_test.py +++ b/tests/expr_and_series/dt/truncate_test.py @@ -3,7 +3,6 @@ from __future__ import annotations from datetime import datetime import pandas as pd -import polars as pl import pytest import narwhals as nw @@ -227,6 +226,10 @@ def test_truncate_custom( ], ) def test_truncate_polars_ns(every: str, expected: list[datetime]) -> None: + pytest.importorskip("polars") + + import polars as pl + df_pl = pl.DataFrame(data, schema={"a": pl.Datetime(time_unit="ns")}) df = nw.from_native(df_pl) result = df.select(nw.col("a").dt.truncate(every))