@@ -20,9 +20,7 @@ def skipif_32bit(param):
2020 return pytest .param (param , marks = marks )
2121
2222
23- @pytest .fixture (
24- scope = "class" , params = ["int32" , "int64" , "float32" , "float64" , "uint64" ]
25- )
23+ @pytest .fixture (scope = "class" , params = ["int64" , "float64" , "uint64" ])
2624def dtype (request ):
2725 return request .param
2826
@@ -39,12 +37,9 @@ def leaf_size(request):
3937@pytest .fixture (
4038 params = [
4139 np .arange (5 , dtype = "int64" ),
42- np .arange (5 , dtype = "int32" ),
4340 np .arange (5 , dtype = "uint64" ),
4441 np .arange (5 , dtype = "float64" ),
45- np .arange (5 , dtype = "float32" ),
4642 np .array ([0 , 1 , 2 , 3 , 4 , np .nan ], dtype = "float64" ),
47- np .array ([0 , 1 , 2 , 3 , 4 , np .nan ], dtype = "float32" ),
4843 ]
4944)
5045def tree (request , leaf_size ):
@@ -64,13 +59,14 @@ def test_get_indexer(self, tree):
6459 tree .get_indexer (np .array ([3.0 ]))
6560
6661 @pytest .mark .parametrize (
67- "dtype, target_value" , [("int64" , 2 ** 63 + 1 ), ("uint64" , - 1 )]
62+ "dtype, target_value, target_dtype" ,
63+ [("int64" , 2 ** 63 + 1 , "uint64" ), ("uint64" , - 1 , "int64" )],
6864 )
69- def test_get_indexer_overflow (self , dtype , target_value ):
65+ def test_get_indexer_overflow (self , dtype , target_value , target_dtype ):
7066 left , right = np .array ([0 , 1 ], dtype = dtype ), np .array ([1 , 2 ], dtype = dtype )
7167 tree = IntervalTree (left , right )
7268
73- result = tree .get_indexer (np .array ([target_value ]))
69+ result = tree .get_indexer (np .array ([target_value ], dtype = target_dtype ))
7470 expected = np .array ([- 1 ], dtype = "intp" )
7571 tm .assert_numpy_array_equal (result , expected )
7672
@@ -94,12 +90,13 @@ def test_get_indexer_non_unique(self, tree):
9490 tm .assert_numpy_array_equal (result , expected )
9591
9692 @pytest .mark .parametrize (
97- "dtype, target_value" , [("int64" , 2 ** 63 + 1 ), ("uint64" , - 1 )]
93+ "dtype, target_value, target_dtype" ,
94+ [("int64" , 2 ** 63 + 1 , "uint64" ), ("uint64" , - 1 , "int64" )],
9895 )
99- def test_get_indexer_non_unique_overflow (self , dtype , target_value ):
96+ def test_get_indexer_non_unique_overflow (self , dtype , target_value , target_dtype ):
10097 left , right = np .array ([0 , 2 ], dtype = dtype ), np .array ([1 , 3 ], dtype = dtype )
10198 tree = IntervalTree (left , right )
102- target = np .array ([target_value ])
99+ target = np .array ([target_value ], dtype = target_dtype )
103100
104101 result_indexer , result_missing = tree .get_indexer_non_unique (target )
105102 expected_indexer = np .array ([- 1 ], dtype = "intp" )
@@ -146,10 +143,10 @@ def test_get_indexer_closed(self, closed, leaf_size):
146143 @pytest .mark .parametrize (
147144 "left, right, expected" ,
148145 [
149- (np .array ([0 , 1 , 4 ]), np .array ([2 , 3 , 5 ]), True ),
150- (np .array ([0 , 1 , 2 ]), np .array ([5 , 4 , 3 ]), True ),
146+ (np .array ([0 , 1 , 4 ], dtype = "int64" ), np .array ([2 , 3 , 5 ]), True ),
147+ (np .array ([0 , 1 , 2 ], dtype = "int64" ), np .array ([5 , 4 , 3 ]), True ),
151148 (np .array ([0 , 1 , np .nan ]), np .array ([5 , 4 , np .nan ]), True ),
152- (np .array ([0 , 2 , 4 ]), np .array ([1 , 3 , 5 ]), False ),
149+ (np .array ([0 , 2 , 4 ], dtype = "int64" ), np .array ([1 , 3 , 5 ]), False ),
153150 (np .array ([0 , 2 , np .nan ]), np .array ([1 , 3 , np .nan ]), False ),
154151 ],
155152 )
@@ -164,7 +161,7 @@ def test_is_overlapping(self, closed, order, left, right, expected):
164161 def test_is_overlapping_endpoints (self , closed , order ):
165162 """shared endpoints are marked as overlapping"""
166163 # GH 23309
167- left , right = np .arange (3 ), np .arange (1 , 4 )
164+ left , right = np .arange (3 , dtype = "int64" ), np .arange (1 , 4 )
168165 tree = IntervalTree (left [order ], right [order ], closed = closed )
169166 result = tree .is_overlapping
170167 expected = closed == "both"
@@ -187,7 +184,7 @@ def test_is_overlapping_trivial(self, closed, left, right):
187184 @pytest .mark .skipif (compat .is_platform_32bit (), reason = "GH 23440" )
188185 def test_construction_overflow (self ):
189186 # GH 25485
190- left , right = np .arange (101 ), [np .iinfo (np .int64 ).max ] * 101
187+ left , right = np .arange (101 , dtype = "int64" ), [np .iinfo (np .int64 ).max ] * 101
191188 tree = IntervalTree (left , right )
192189
193190 # pivot should be average of left/right medians
0 commit comments