diff --git a/tests/expr_and_series/dt/ordinal_day_test.py b/tests/expr_and_series/dt/ordinal_day_test.py index 44db1d3dc..5f8d69d6b 100644 --- a/tests/expr_and_series/dt/ordinal_day_test.py +++ b/tests/expr_and_series/dt/ordinal_day_test.py @@ -38,5 +38,7 @@ def test_ordinal_day(dates: datetime) -> None: except ImportError: pass else: - result_pl = nw.from_native(pl.Series([dates]), series_only=True).dt.ordinal_day()[0] + result_pl = nw.from_native(pl.Series([dates]), series_only=True).dt.ordinal_day()[ + 0 + ] assert result_pl == result_pd diff --git a/tests/expr_and_series/is_nan_test.py b/tests/expr_and_series/is_nan_test.py index 2dd79ed93..4b0459f3b 100644 --- a/tests/expr_and_series/is_nan_test.py +++ b/tests/expr_and_series/is_nan_test.py @@ -52,10 +52,9 @@ def test_nan(constructor: Constructor) -> None: if "polars_lazy" in str(constructor) and os.environ.get("NARWHALS_POLARS_GPU", False): from polars.exceptions import ComputeError - context = ( - pytest.raises( - ComputeError, match="NAN is not supported in a Non-floating point type column" - ) + + context = pytest.raises( + ComputeError, match="NAN is not supported in a Non-floating point type column" ) else: context = does_not_raise() @@ -105,9 +104,11 @@ def test_nan_non_float(constructor: Constructor, request: pytest.FixtureRequest) exc = NwInvalidOperationError if "polars" in str(constructor): from polars.exceptions import InvalidOperationError as PlInvalidOperationError + exc = PlInvalidOperationError elif "pyarrow_table" in str(constructor): from pyarrow.lib import ArrowNotImplementedError + exc = ArrowNotImplementedError with pytest.raises(exc): @@ -123,9 +124,11 @@ def test_nan_non_float_series(constructor_eager: ConstructorEager) -> None: exc = NwInvalidOperationError if "polars" in str(constructor_eager): from polars.exceptions import InvalidOperationError as PlInvalidOperationError + exc = PlInvalidOperationError elif "pyarrow_table" in str(constructor_eager): from pyarrow.lib import ArrowNotImplementedError + exc = ArrowNotImplementedError with pytest.raises(exc): diff --git a/tests/frame/explode_test.py b/tests/frame/explode_test.py index 4a77fc3fb..0af4d6af9 100644 --- a/tests/frame/explode_test.py +++ b/tests/frame/explode_test.py @@ -117,6 +117,7 @@ def test_explode_shape_error( expected_exceptions = (ShapeError,) if "polars" in str(constructor): from polars.exceptions import ShapeError as PlShapeError + expected_exceptions = expected_exceptions + (PlShapeError,) with pytest.raises( expected_exceptions, @@ -143,6 +144,7 @@ def test_explode_invalid_operation_error( expected_exceptions = (InvalidOperationError,) if "polars" in str(constructor): from polars.exceptions import InvalidOperationError as PlInvalidOperationError + expected_exceptions = expected_exceptions + (PlInvalidOperationError,) with pytest.raises( expected_exceptions, diff --git a/tests/frame/filter_test.py b/tests/frame/filter_test.py index 78014d0ab..3b63f017f 100644 --- a/tests/frame/filter_test.py +++ b/tests/frame/filter_test.py @@ -46,6 +46,7 @@ def test_filter_raise_on_shape_mismatch(constructor: Constructor) -> None: expected_exceptions = (LengthChangingExprError, ShapeError) if "polars" in str(constructor): from polars.exceptions import ShapeError as PlShapeError + expected_exceptions = expected_exceptions + (PlShapeError,) with pytest.raises(expected_exceptions): df.filter(nw.col("b").unique() > 2).lazy().collect()