2
2
The tests in this package are to ensure the proper resultant dtypes of
3
3
set operations.
4
4
"""
5
- import itertools as it
6
-
7
5
import numpy as np
8
6
import pytest
9
7
13
11
from pandas import Float64Index , Int64Index , RangeIndex , UInt64Index
14
12
import pandas ._testing as tm
15
13
from pandas .api .types import pandas_dtype
16
- from pandas .conftest import indices_dict
17
14
18
15
COMPATIBLE_INCONSISTENT_PAIRS = {
19
16
(Int64Index , RangeIndex ): (tm .makeIntIndex , tm .makeRangeIndex ),
23
20
}
24
21
25
22
26
- @pytest .fixture (params = it .combinations (indices_dict , 2 ), ids = "-" .join )
27
- def index_pair (request ):
28
- """
29
- Create all combinations of 2 index types.
30
- """
31
- return indices_dict [request .param [0 ]], indices_dict [request .param [1 ]]
32
-
33
-
34
23
def test_union_same_types (indices ):
35
24
# Union with a non-unique, non-monotonic index raises error
36
25
# Only needed for bool index factory
@@ -39,14 +28,15 @@ def test_union_same_types(indices):
39
28
assert idx1 .union (idx2 ).dtype == idx1 .dtype
40
29
41
30
42
- def test_union_different_types (index_pair ):
31
+ def test_union_different_types (indices , index_fixture2 ):
32
+ # This test only considers combinations of indices
43
33
# GH 23525
44
- idx1 , idx2 = index_pair
34
+ idx1 , idx2 = indices , index_fixture2
45
35
type_pair = tuple (sorted ([type (idx1 ), type (idx2 )], key = lambda x : str (x )))
46
36
if type_pair in COMPATIBLE_INCONSISTENT_PAIRS :
47
37
pytest .xfail ("This test only considers non compatible indexes." )
48
38
49
- if any (isinstance (idx , pd .MultiIndex ) for idx in index_pair ):
39
+ if any (isinstance (idx , pd .MultiIndex ) for idx in ( idx1 , idx2 ) ):
50
40
pytest .xfail ("This test doesn't consider multiindixes." )
51
41
52
42
if is_dtype_equal (idx1 .dtype , idx2 .dtype ):
0 commit comments