Skip to content

Commit

Permalink
test all column comparisons in lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Aug 9, 2023
1 parent fa13738 commit fd2b643
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tests/column/comparisons_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from tests.utils import convert_series_to_pandas_numpy
from tests.utils import integer_dataframe_1
from tests.utils import integer_dataframe_7
from tests.utils import integer_series_1
from tests.utils import interchange_to_pandas


Expand All @@ -34,7 +33,6 @@ def test_column_comparisons(
library: str,
comparison: str,
expected_data: list[object],
request: pytest.FixtureRequest,
) -> None:
ser: Any
df = integer_dataframe_7(library)
Expand Down Expand Up @@ -69,20 +67,14 @@ def test_column_comparisons_scalar(
library: str,
comparison: str,
expected_data: list[object],
request: pytest.FixtureRequest,
) -> None:
ser: Any
ser = integer_series_1(library, request)
df = integer_dataframe_1(library)
ser = df.get_column_by_name("a")
other = 3
namespace = ser.__column_namespace__()
result = namespace.dataframe_from_dict(
{"result": (getattr(ser, comparison)(other)).rename("result")}
)
result_pd = pd.api.interchange.from_dataframe(result.dataframe)["result"]
result = df.insert(0, "result", (getattr(ser, comparison)(other)))
result_pd = interchange_to_pandas(result, library)["result"]
expected = pd.Series(expected_data, name="result")
if library == "polars" and comparison == "__pow__":
# todo: fix
result_pd = result_pd.astype("int64")
result_pd = convert_series_to_pandas_numpy(result_pd)
pd.testing.assert_series_equal(result_pd, expected)

Expand Down

0 comments on commit fd2b643

Please sign in to comment.