(dtype)
| 1506 | |
| 1507 | |
| 1508 | def test_findall_broadcast(dtype) -> None: |
| 1509 | value = xr.DataArray( |
| 1510 | ["a_Xy_0", "ab_xY_10", "abc_Xy_01"], |
| 1511 | dims=["X"], |
| 1512 | ).astype(dtype) |
| 1513 | |
| 1514 | pat_str = xr.DataArray( |
| 1515 | [r"(\w+)_Xy_\d*", r"\w+_Xy_(\d*)"], |
| 1516 | dims=["Y"], |
| 1517 | ).astype(dtype) |
| 1518 | pat_re = value.str._re_compile(pat=pat_str) |
| 1519 | |
| 1520 | expected_list: list[list[list]] = [[["a"], ["0"]], [[], []], [["abc"], ["01"]]] |
| 1521 | expected_dtype = [[[dtype(x) for x in y] for y in z] for z in expected_list] |
| 1522 | expected_np = np.array(expected_dtype, dtype=np.object_) |
| 1523 | expected = xr.DataArray(expected_np, dims=["X", "Y"]) |
| 1524 | |
| 1525 | res_str = value.str.findall(pat=pat_str) |
| 1526 | res_re = value.str.findall(pat=pat_re) |
| 1527 | |
| 1528 | assert res_str.dtype == expected.dtype |
| 1529 | assert res_re.dtype == expected.dtype |
| 1530 | |
| 1531 | assert_equal(res_str, expected) |
| 1532 | assert_equal(res_re, expected) |
| 1533 | |
| 1534 | |
| 1535 | def test_repeat(dtype) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…