Skip to content

Commit

Permalink
CLN: tests.indexes.test_setop.py (pandas-dev#41121)
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 authored and yeshsurya committed May 6, 2021
1 parent f41d59c commit 009cfd3
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions pandas/tests/indexes/test_setops.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
Index,
Int64Index,
MultiIndex,
RangeIndex,
Series,
TimedeltaIndex,
Timestamp,
Expand All @@ -29,12 +28,10 @@
pandas_dtype,
)

COMPATIBLE_INCONSISTENT_PAIRS = {
(Int64Index, RangeIndex): (tm.makeIntIndex, tm.makeRangeIndex),
(Float64Index, Int64Index): (tm.makeFloatIndex, tm.makeIntIndex),
(Float64Index, RangeIndex): (tm.makeFloatIndex, tm.makeIntIndex),
(Float64Index, UInt64Index): (tm.makeFloatIndex, tm.makeUIntIndex),
}
COMPATIBLE_INCONSISTENT_PAIRS = [
(np.float64, np.int64),
(np.float64, np.uint64),
]


def test_union_same_types(index):
Expand All @@ -51,7 +48,7 @@ def test_union_different_types(index_flat, index_flat2):
idx1 = index_flat
idx2 = index_flat2

type_pair = tuple(sorted([type(idx1), type(idx2)], key=lambda x: str(x)))
type_pair = tuple(sorted([idx1.dtype.type, idx2.dtype.type], key=lambda x: str(x)))

# Union with a non-unique, non-monotonic index raises error
# This applies to the boolean index
Expand Down Expand Up @@ -80,7 +77,15 @@ def test_union_different_types(index_flat, index_flat2):
raise NotImplementedError


@pytest.mark.parametrize("idx_fact1,idx_fact2", COMPATIBLE_INCONSISTENT_PAIRS.values())
@pytest.mark.parametrize(
"idx_fact1,idx_fact2",
[
(tm.makeIntIndex, tm.makeRangeIndex),
(tm.makeFloatIndex, tm.makeIntIndex),
(tm.makeFloatIndex, tm.makeRangeIndex),
(tm.makeFloatIndex, tm.makeUIntIndex),
],
)
def test_compatible_inconsistent_pairs(idx_fact1, idx_fact2):
# GH 23525
idx1 = idx_fact1(10)
Expand Down

0 comments on commit 009cfd3

Please sign in to comment.