Skip to content

Commit 05c23dd

Browse files
committed
fix failures
1 parent 0d503ce commit 05c23dd

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

pandas/tests/arithmetic/conftest.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
import pandas as pd
55
from pandas import RangeIndex
66
import pandas._testing as tm
7-
from pandas.core.api import (
8-
Float64Index,
9-
Int64Index,
10-
UInt64Index,
11-
)
7+
from pandas.core.api import NumericIndex
128
from pandas.core.computation import expressions as expr
139

1410

@@ -90,9 +86,10 @@ def zero(request):
9086

9187
@pytest.fixture(
9288
params=[
93-
Float64Index(np.arange(5, dtype="float64")),
94-
Int64Index(np.arange(5, dtype="int64")),
95-
UInt64Index(np.arange(5, dtype="uint64")),
89+
# TODO: add more dtypes here
90+
NumericIndex(np.arange(5, dtype="float64")),
91+
NumericIndex(np.arange(5, dtype="int64")),
92+
NumericIndex(np.arange(5, dtype="uint64")),
9693
RangeIndex(5),
9794
],
9895
ids=lambda x: type(x).__name__,

pandas/tests/arithmetic/test_numeric.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def test_divmod_zero(self, zero, numeric_idx):
377377
@pytest.mark.parametrize("op", [operator.truediv, operator.floordiv])
378378
def test_div_negative_zero(self, zero, numeric_idx, op):
379379
# Check that -1 / -0.0 returns np.inf, not -np.inf
380-
if isinstance(numeric_idx, UInt64Index):
380+
if numeric_idx.dtype == np.uint64:
381381
return
382382
idx = numeric_idx - 3
383383

@@ -669,15 +669,15 @@ def test_mul_int_array(self, numeric_idx):
669669
result = idx * np.array(5, dtype="int64")
670670
tm.assert_index_equal(result, idx * 5)
671671

672-
arr_dtype = "uint64" if isinstance(idx, UInt64Index) else "int64"
672+
arr_dtype = "uint64" if idx.dtype == np.uint64 else "int64"
673673
result = idx * np.arange(5, dtype=arr_dtype)
674674
tm.assert_index_equal(result, didx)
675675

676676
def test_mul_int_series(self, numeric_idx):
677677
idx = numeric_idx
678678
didx = idx * idx
679679

680-
arr_dtype = "uint64" if isinstance(idx, UInt64Index) else "int64"
680+
arr_dtype = "uint64" if idx.dtype == np.uint64 else "int64"
681681
result = idx * Series(np.arange(5, dtype=arr_dtype))
682682
tm.assert_series_equal(result, Series(didx))
683683

@@ -714,7 +714,7 @@ def test_pow_float(self, op, numeric_idx, box_with_array):
714714
# test power calculations both ways, GH#14973
715715
box = box_with_array
716716
idx = numeric_idx
717-
expected = Float64Index(op(idx.values, 2.0))
717+
expected = Index(op(idx.values, 2.0))
718718

719719
idx = tm.box_expected(idx, box)
720720
expected = tm.box_expected(expected, box)
@@ -1216,7 +1216,7 @@ def test_binops_index(self, op, idx1, idx2):
12161216
idx1 = idx1._rename("foo")
12171217
idx2 = idx2._rename("bar")
12181218
result = op(idx1, idx2)
1219-
expected = op(Int64Index(idx1), Int64Index(idx2))
1219+
expected = op(Index(idx1.to_numpy()), Index(idx2.to_numpy()))
12201220
tm.assert_index_equal(result, expected, exact="equiv")
12211221

12221222
@pytest.mark.parametrize(
@@ -1252,7 +1252,7 @@ def test_binops_index_pow(self, idx1, idx2):
12521252
idx1 = idx1._rename("foo")
12531253
idx2 = idx2._rename("bar")
12541254
result = pow(idx1, idx2)
1255-
expected = pow(Int64Index(idx1), Int64Index(idx2))
1255+
expected = pow(Index(idx1.to_numpy()), Index(idx2.to_numpy()))
12561256
tm.assert_index_equal(result, expected, exact="equiv")
12571257

12581258
@pytest.mark.parametrize("idx", [RangeIndex(0, 10, 1), RangeIndex(0, 20, 2)])
@@ -1330,7 +1330,7 @@ def test_numeric_compat2(self):
13301330
# __pow__
13311331
idx = RangeIndex(0, 1000, 2)
13321332
result = idx**2
1333-
expected = Int64Index(idx._values) ** 2
1333+
expected = Index(idx._values) ** 2
13341334
tm.assert_index_equal(Index(result.values), expected, exact=True)
13351335

13361336
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)