@@ -881,3 +881,75 @@ 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+ _arr = arr = np .random .randn (10 )
916+
917+
918+ @pytest .fixture
919+ def int_series ():
920+ """ Fixture for Series with random numbers and integer index """
921+ index = _int_index .copy (deep = True )
922+ return pd .Series (_arr , index = index , name = index .name )
923+
924+
925+ _series = [pd .Series (_arr , index = index , name = index .name ) for index in _indexes ]
926+ _series_ids = [f"series-with-{ index_id } " for index_id in _index_ids ]
927+
928+ _arr_int = np .random .choice (10 , size = 10 , replace = False )
929+ _narrow_series = [
930+ pd .Series (_arr .astype (np .float32 ), index = _int_index , name = "a" ),
931+ pd .Series (_arr_int .astype (np .int8 ), index = _int_index , name = "a" ),
932+ pd .Series (_arr_int .astype (np .int16 ), index = _int_index , name = "a" ),
933+ pd .Series (_arr_int .astype (np .int32 ), index = _int_index , name = "a" ),
934+ pd .Series (_arr_int .astype (np .uint8 ), index = _int_index , name = "a" ),
935+ pd .Series (_arr_int .astype (np .uint16 ), index = _int_index , name = "a" ),
936+ pd .Series (_arr_int .astype (np .uint32 ), index = _int_index , name = "a" ),
937+ ]
938+ _narrow_series_ids = [
939+ "float32-series" ,
940+ "int8-series" ,
941+ "int16-series" ,
942+ "int32-series" ,
943+ "uint8-series" ,
944+ "uint16-series" ,
945+ "uint32-series" ,
946+ ]
947+
948+ _all_objs = _indexes + _series + _narrow_series
949+ _all_obj_ids = _index_ids + _series_ids + _narrow_series_ids
950+
951+
952+ @pytest .fixture (params = _all_objs , ids = _all_obj_ids )
953+ def index_or_series_obj (request ):
954+ """ Fixture for tests on indexes, series and series with a narrow dtype """
955+ return request .param .copy (deep = True )
0 commit comments