17
17
Index ,
18
18
Int64Index ,
19
19
MultiIndex ,
20
- RangeIndex ,
21
20
Series ,
22
21
TimedeltaIndex ,
23
22
Timestamp ,
29
28
pandas_dtype ,
30
29
)
31
30
32
- COMPATIBLE_INCONSISTENT_PAIRS = {
33
- (Int64Index , RangeIndex ): (tm .makeIntIndex , tm .makeRangeIndex ),
34
- (Float64Index , Int64Index ): (tm .makeFloatIndex , tm .makeIntIndex ),
35
- (Float64Index , RangeIndex ): (tm .makeFloatIndex , tm .makeIntIndex ),
36
- (Float64Index , UInt64Index ): (tm .makeFloatIndex , tm .makeUIntIndex ),
37
- }
31
+ COMPATIBLE_INCONSISTENT_PAIRS = [
32
+ (np .float64 , np .int64 ),
33
+ (np .float64 , np .uint64 ),
34
+ ]
38
35
39
36
40
37
def test_union_same_types (index ):
@@ -51,7 +48,7 @@ def test_union_different_types(index_flat, index_flat2):
51
48
idx1 = index_flat
52
49
idx2 = index_flat2
53
50
54
- type_pair = tuple (sorted ([type ( idx1 ), type ( idx2 ) ], key = lambda x : str (x )))
51
+ type_pair = tuple (sorted ([idx1 . dtype . type , idx2 . dtype . type ], key = lambda x : str (x )))
55
52
56
53
# Union with a non-unique, non-monotonic index raises error
57
54
# This applies to the boolean index
@@ -80,7 +77,15 @@ def test_union_different_types(index_flat, index_flat2):
80
77
raise NotImplementedError
81
78
82
79
83
- @pytest .mark .parametrize ("idx_fact1,idx_fact2" , COMPATIBLE_INCONSISTENT_PAIRS .values ())
80
+ @pytest .mark .parametrize (
81
+ "idx_fact1,idx_fact2" ,
82
+ [
83
+ (tm .makeIntIndex , tm .makeRangeIndex ),
84
+ (tm .makeFloatIndex , tm .makeIntIndex ),
85
+ (tm .makeFloatIndex , tm .makeRangeIndex ),
86
+ (tm .makeFloatIndex , tm .makeUIntIndex ),
87
+ ],
88
+ )
84
89
def test_compatible_inconsistent_pairs (idx_fact1 , idx_fact2 ):
85
90
# GH 23525
86
91
idx1 = idx_fact1 (10 )
0 commit comments