@@ -881,3 +881,73 @@ def index_or_series(request):
881881 See GH#29725
882882 """
883883 return request .param
884+
885+
886+ _int_index = tm .makeIntIndex (10 , name = "a" )
887+ _indexes = [
888+ tm .makeBoolIndex (10 , name = "a" ),
889+ _int_index ,
890+ tm .makeFloatIndex (10 , name = "a" ),
891+ tm .makeDateIndex (10 , name = "a" ),
892+ tm .makeDateIndex (10 , name = "a" , tz = "US/Eastern" ),
893+ tm .makePeriodIndex (10 , name = "a" ),
894+ tm .makeStringIndex (10 , name = "a" ),
895+ tm .makeUnicodeIndex (10 , name = "a" ),
896+ ]
897+ _index_ids = [
898+ "bool-index" ,
899+ "int-index" ,
900+ "float-index" ,
901+ "date-index" ,
902+ "localized date-index" ,
903+ "period-index" ,
904+ "string-index" ,
905+ "unicode-index" ,
906+ ]
907+
908+
909+ @pytest .fixture (params = _indexes , ids = _index_ids )
910+ def index (request ):
911+ """ Fixture for tests on indexes """
912+ return request .param .copy (deep = True )
913+
914+
915+ @pytest .fixture
916+ def int_series ():
917+ index = _int_index .copy (deep = True )
918+ return pd .Series (_arr , index = index , name = index .name )
919+
920+
921+ _arr = arr = np .random .randn (10 )
922+ _arr_int = np .random .choice (10 , size = 10 , replace = False )
923+
924+ _series = [pd .Series (_arr , index = index , name = index .name ) for index in _indexes ]
925+ _series_ids = [f"series-with-{ index_id } " for index_id in _index_ids ]
926+
927+ _narrow_series = [
928+ pd .Series (_arr .astype (np .float32 ), index = _int_index , name = "a" ),
929+ pd .Series (_arr_int .astype (np .int8 ), index = _int_index , name = "a" ),
930+ pd .Series (_arr_int .astype (np .int16 ), index = _int_index , name = "a" ),
931+ pd .Series (_arr_int .astype (np .int32 ), index = _int_index , name = "a" ),
932+ pd .Series (_arr_int .astype (np .uint8 ), index = _int_index , name = "a" ),
933+ pd .Series (_arr_int .astype (np .uint16 ), index = _int_index , name = "a" ),
934+ pd .Series (_arr_int .astype (np .uint32 ), index = _int_index , name = "a" ),
935+ ]
936+ _narrow_series_ids = [
937+ "float32-series" ,
938+ "int8-series" ,
939+ "int16-series" ,
940+ "int32-series" ,
941+ "uint8-series" ,
942+ "uint16-series" ,
943+ "uint32-series" ,
944+ ]
945+
946+ _all_objs = _indexes + _series + _narrow_series
947+ _all_obj_ids = _index_ids + _series_ids + _narrow_series_ids
948+
949+
950+ @pytest .fixture (params = _all_objs , ids = _all_obj_ids )
951+ def index_or_series_obj (request ):
952+ """ Fixture for tests on indexes, series and series with a narrow dtype """
953+ return request .param .copy (deep = True )
0 commit comments