Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 30, 2025
1 parent 0c48c75 commit 1be04ff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion tests/expr_and_series/dt/ordinal_day_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 7 additions & 4 deletions tests/expr_and_series/is_nan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions tests/frame/explode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/frame/filter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 1be04ff

Please sign in to comment.