@@ -40,9 +40,10 @@ class ConstructorTests:
4040 get_kwargs_from_breaks to the expected format.
4141 """
4242
43- # get_kwargs_from_breaks in TestFromTuples and TestClassconstructors just return
44- # tuples of ints, so IntervalIndex can't know the original dtype was uint
45- _use_dtype_in_test_constructor_uint = False
43+ def _skip_test_constructor (self , dtype ):
44+ # get_kwargs_from_breaks in TestFromTuples and TestClassconstructors just return
45+ # tuples of ints, so IntervalIndex can't know the original dtype
46+ return False , ""
4647
4748 @pytest .mark .parametrize (
4849 "breaks" ,
@@ -60,9 +61,13 @@ class ConstructorTests:
6061 @pytest .mark .parametrize ("use_dtype" , [True , False ])
6162 def test_constructor (self , constructor , breaks , closed , name , use_dtype ):
6263 breaks_dtype = getattr (breaks , "dtype" , "int64" )
64+
65+ skip , skip_msg = self ._skip_test_constructor (breaks_dtype )
66+ if skip :
67+ pytest .skip (skip_msg )
68+
6369 result_kwargs = self .get_kwargs_from_breaks (breaks , closed )
64- is_uint = is_unsigned_integer_dtype (breaks_dtype )
65- if use_dtype or (self ._use_dtype_in_test_constructor_uint and is_uint ):
70+ if use_dtype :
6671 result_kwargs ["dtype" ] = IntervalDtype (breaks_dtype , closed = closed )
6772
6873 result = constructor (closed = closed , name = name , ** result_kwargs )
@@ -307,7 +312,11 @@ def test_left_right_dont_share_data(self):
307312class TestFromTuples (ConstructorTests ):
308313 """Tests specific to IntervalIndex.from_tuples"""
309314
310- _use_dtype_in_test_constructor_uint = True
315+ def _skip_test_constructor (self , dtype ):
316+ if is_unsigned_integer_dtype (dtype ):
317+ return True , "tuples don't have a dtype"
318+ else :
319+ return False , ""
311320
312321 @pytest .fixture
313322 def constructor (self ):
@@ -356,7 +365,13 @@ def test_na_tuples(self):
356365class TestClassConstructors (ConstructorTests ):
357366 """Tests specific to the IntervalIndex/Index constructors"""
358367
359- _use_dtype_in_test_constructor_uint = True
368+ def _skip_test_constructor (self , dtype ):
369+ # get_kwargs_from_breaks in TestFromTuples and TestClassconstructors just return
370+ # tuples of ints, so IntervalIndex can't know the original dtype
371+ if is_unsigned_integer_dtype (dtype ):
372+ return True , "tuples don't have a dtype"
373+ else :
374+ return False , ""
360375
361376 @pytest .fixture (
362377 params = [IntervalIndex , partial (Index , dtype = "interval" )],
0 commit comments