Skip to content

Commit

Permalink
is_nan tests better coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
camriddell committed Dec 27, 2024
1 parent d864063 commit bacd81f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/expr_and_series/is_nan_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import annotations

import pytest

import narwhals.stable.v1 as nw
from narwhals.exceptions import InvalidOperationError
from tests.conftest import dask_lazy_p2_constructor
from tests.conftest import pandas_constructor
from tests.utils import Constructor
Expand Down Expand Up @@ -38,3 +41,14 @@ def test_nan_series(constructor_eager: ConstructorEager) -> None:
expected = {"a": [True, False, None]} # type: ignore[list-item]

assert_equal_data(result, expected)


def test_nan_non_float() -> None:
data = {"a": ["0", "1"]}
pd_df = nw.from_native(pandas_constructor(data))
with pytest.raises(InvalidOperationError, match="not supported"):
pd_df.select(nw.col("a").is_nan())

dd_df = nw.from_native(dask_lazy_p2_constructor(data))
with pytest.raises(InvalidOperationError, match="not supported"):
dd_df.select(nw.col("a").is_nan())

0 comments on commit bacd81f

Please sign in to comment.