(dtype)
| 3336 | |
| 3337 | |
| 3338 | def test_cat_broadcast_both(dtype) -> None: |
| 3339 | values_1 = xr.DataArray( |
| 3340 | ["a", "bb", "cccc"], |
| 3341 | dims=["Y"], |
| 3342 | ).astype(dtype) |
| 3343 | values_2 = xr.DataArray( |
| 3344 | ["11111", "4"], |
| 3345 | dims=["X"], |
| 3346 | ) |
| 3347 | |
| 3348 | targ_blank = ( |
| 3349 | xr.DataArray( |
| 3350 | [["a11111", "bb11111", "cccc11111"], ["a4", "bb4", "cccc4"]], |
| 3351 | dims=["X", "Y"], |
| 3352 | ) |
| 3353 | .astype(dtype) |
| 3354 | .T |
| 3355 | ) |
| 3356 | |
| 3357 | targ_space = ( |
| 3358 | xr.DataArray( |
| 3359 | [["a 11111", "bb 11111", "cccc 11111"], ["a 4", "bb 4", "cccc 4"]], |
| 3360 | dims=["X", "Y"], |
| 3361 | ) |
| 3362 | .astype(dtype) |
| 3363 | .T |
| 3364 | ) |
| 3365 | |
| 3366 | targ_bars = ( |
| 3367 | xr.DataArray( |
| 3368 | [["a||11111", "bb||11111", "cccc||11111"], ["a||4", "bb||4", "cccc||4"]], |
| 3369 | dims=["X", "Y"], |
| 3370 | ) |
| 3371 | .astype(dtype) |
| 3372 | .T |
| 3373 | ) |
| 3374 | |
| 3375 | targ_comma = ( |
| 3376 | xr.DataArray( |
| 3377 | [["a, 11111", "bb, 11111", "cccc, 11111"], ["a, 4", "bb, 4", "cccc, 4"]], |
| 3378 | dims=["X", "Y"], |
| 3379 | ) |
| 3380 | .astype(dtype) |
| 3381 | .T |
| 3382 | ) |
| 3383 | |
| 3384 | res_blank = values_1.str.cat(values_2) |
| 3385 | res_add = values_1.str + values_2 |
| 3386 | res_space = values_1.str.cat(values_2, sep=" ") |
| 3387 | res_bars = values_1.str.cat(values_2, sep="||") |
| 3388 | res_comma = values_1.str.cat(values_2, sep=", ") |
| 3389 | |
| 3390 | assert res_blank.dtype == targ_blank.dtype |
| 3391 | assert res_add.dtype == targ_blank.dtype |
| 3392 | assert res_space.dtype == targ_space.dtype |
| 3393 | assert res_bars.dtype == targ_bars.dtype |
| 3394 | assert res_comma.dtype == targ_comma.dtype |
| 3395 |
nothing calls this directly
no test coverage detected
searching dependent graphs…