(dtype)
| 3052 | |
| 3053 | |
| 3054 | def test_splitters_empty_str(dtype) -> None: |
| 3055 | values = xr.DataArray( |
| 3056 | [["", "", ""], ["", "", ""]], |
| 3057 | dims=["X", "Y"], |
| 3058 | ).astype(dtype) |
| 3059 | |
| 3060 | targ_partition_dim = xr.DataArray( |
| 3061 | [ |
| 3062 | [["", "", ""], ["", "", ""], ["", "", ""]], |
| 3063 | [["", "", ""], ["", "", ""], ["", "", ""]], |
| 3064 | ], |
| 3065 | dims=["X", "Y", "ZZ"], |
| 3066 | ).astype(dtype) |
| 3067 | |
| 3068 | targ_partition_none_list = [ |
| 3069 | [["", "", ""], ["", "", ""], ["", "", ""]], |
| 3070 | [["", "", ""], ["", "", ""], ["", "", "", ""]], |
| 3071 | ] |
| 3072 | targ_partition_none_list = [ |
| 3073 | [[dtype(x) for x in y] for y in z] for z in targ_partition_none_list |
| 3074 | ] |
| 3075 | targ_partition_none_np = np.array(targ_partition_none_list, dtype=np.object_) |
| 3076 | del targ_partition_none_np[-1, -1][-1] |
| 3077 | targ_partition_none = xr.DataArray( |
| 3078 | targ_partition_none_np, |
| 3079 | dims=["X", "Y"], |
| 3080 | ) |
| 3081 | |
| 3082 | targ_split_dim = xr.DataArray( |
| 3083 | [[[""], [""], [""]], [[""], [""], [""]]], |
| 3084 | dims=["X", "Y", "ZZ"], |
| 3085 | ).astype(dtype) |
| 3086 | targ_split_none = xr.DataArray( |
| 3087 | np.array([[[], [], []], [[], [], [""]]], dtype=np.object_), |
| 3088 | dims=["X", "Y"], |
| 3089 | ) |
| 3090 | del targ_split_none.data[-1, -1][-1] |
| 3091 | |
| 3092 | res_partition_dim = values.str.partition(dim="ZZ") |
| 3093 | res_rpartition_dim = values.str.rpartition(dim="ZZ") |
| 3094 | res_partition_none = values.str.partition(dim=None) |
| 3095 | res_rpartition_none = values.str.rpartition(dim=None) |
| 3096 | |
| 3097 | res_split_dim = values.str.split(dim="ZZ") |
| 3098 | res_rsplit_dim = values.str.rsplit(dim="ZZ") |
| 3099 | res_split_none = values.str.split(dim=None) |
| 3100 | res_rsplit_none = values.str.rsplit(dim=None) |
| 3101 | |
| 3102 | res_dummies = values.str.rsplit(dim="ZZ") |
| 3103 | |
| 3104 | assert res_partition_dim.dtype == targ_partition_dim.dtype |
| 3105 | assert res_rpartition_dim.dtype == targ_partition_dim.dtype |
| 3106 | assert res_partition_none.dtype == targ_partition_none.dtype |
| 3107 | assert res_rpartition_none.dtype == targ_partition_none.dtype |
| 3108 | |
| 3109 | assert res_split_dim.dtype == targ_split_dim.dtype |
| 3110 | assert res_rsplit_dim.dtype == targ_split_dim.dtype |
| 3111 | assert res_split_none.dtype == targ_split_none.dtype |
nothing calls this directly
no test coverage detected
searching dependent graphs…