Skip to content

Commit 76b7616

Browse files
FrancescAltedclaude
andcommitted
Guard pandas import in test_groupby.py (fixes CI collection failure)
pandas is an optional dependency in this repo; the module-level `import pandas as pd` broke test collection in CI environments without it installed. Moved to pytest.importorskip("pandas") inside the one test that needs it, and rewrote the other new test that only used to_pandas() for convenience to compare via the existing col() helper instead, dropping the pandas dependency entirely there. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 560d149 commit 76b7616

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/ctable/test_groupby.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from dataclasses import dataclass, make_dataclass
99

1010
import numpy as np
11-
import pandas as pd
1211
import pytest
1312

1413
import blosc2
@@ -421,7 +420,8 @@ def test_groupby_engine_numpy_matches_auto():
421420
t = CTable(SalesRow, new_data=DATA)
422421
auto_result = t.group_by("city", engine="auto").sum("sales")
423422
numpy_result = t.group_by("city", engine="numpy").sum("sales")
424-
assert auto_result.to_pandas().equals(numpy_result.to_pandas())
423+
assert col(auto_result, "city") == col(numpy_result, "city")
424+
np.testing.assert_array_equal(col(auto_result, "sales_sum"), col(numpy_result, "sales_sum"))
425425

426426

427427
def test_groupby_engine_jit_not_implemented():
@@ -827,6 +827,7 @@ def test_agg_duplicate_output_names_rejected():
827827

828828

829829
def test_agg_udf_matches_pandas_reference():
830+
pd = pytest.importorskip("pandas")
830831
t = CTable(SalesRow, new_data=DATA)
831832
result = t.group_by("city", sort=True).agg(rng=("sales", lambda a: a.max() - a.min()))
832833

0 commit comments

Comments
 (0)