(dtype)
| 3127 | |
| 3128 | |
| 3129 | def test_cat_str(dtype) -> None: |
| 3130 | values_1 = xr.DataArray( |
| 3131 | [["a", "bb", "cccc"], ["ddddd", "eeee", "fff"]], |
| 3132 | dims=["X", "Y"], |
| 3133 | ).astype(dtype) |
| 3134 | values_2 = "111" |
| 3135 | |
| 3136 | targ_blank = xr.DataArray( |
| 3137 | [["a111", "bb111", "cccc111"], ["ddddd111", "eeee111", "fff111"]], |
| 3138 | dims=["X", "Y"], |
| 3139 | ).astype(dtype) |
| 3140 | |
| 3141 | targ_space = xr.DataArray( |
| 3142 | [["a 111", "bb 111", "cccc 111"], ["ddddd 111", "eeee 111", "fff 111"]], |
| 3143 | dims=["X", "Y"], |
| 3144 | ).astype(dtype) |
| 3145 | |
| 3146 | targ_bars = xr.DataArray( |
| 3147 | [["a||111", "bb||111", "cccc||111"], ["ddddd||111", "eeee||111", "fff||111"]], |
| 3148 | dims=["X", "Y"], |
| 3149 | ).astype(dtype) |
| 3150 | |
| 3151 | targ_comma = xr.DataArray( |
| 3152 | [["a, 111", "bb, 111", "cccc, 111"], ["ddddd, 111", "eeee, 111", "fff, 111"]], |
| 3153 | dims=["X", "Y"], |
| 3154 | ).astype(dtype) |
| 3155 | |
| 3156 | res_blank = values_1.str.cat(values_2) |
| 3157 | res_add = values_1.str + values_2 |
| 3158 | res_space = values_1.str.cat(values_2, sep=" ") |
| 3159 | res_bars = values_1.str.cat(values_2, sep="||") |
| 3160 | res_comma = values_1.str.cat(values_2, sep=", ") |
| 3161 | |
| 3162 | assert res_blank.dtype == targ_blank.dtype |
| 3163 | assert res_add.dtype == targ_blank.dtype |
| 3164 | assert res_space.dtype == targ_space.dtype |
| 3165 | assert res_bars.dtype == targ_bars.dtype |
| 3166 | assert res_comma.dtype == targ_comma.dtype |
| 3167 | |
| 3168 | assert_equal(res_blank, targ_blank) |
| 3169 | assert_equal(res_add, targ_blank) |
| 3170 | assert_equal(res_space, targ_space) |
| 3171 | assert_equal(res_bars, targ_bars) |
| 3172 | assert_equal(res_comma, targ_comma) |
| 3173 | |
| 3174 | |
| 3175 | def test_cat_uniform(dtype) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…