(dtype)
| 1188 | |
| 1189 | |
| 1190 | def test_extractall_broadcast(dtype) -> None: |
| 1191 | value = xr.DataArray( |
| 1192 | ["a_Xy_0", "ab_xY_10", "abc_Xy_01"], |
| 1193 | dims=["X"], |
| 1194 | ).astype(dtype) |
| 1195 | |
| 1196 | pat_str = xr.DataArray( |
| 1197 | [r"(\w+)_Xy_(\d*)", r"(\w+)_xY_(\d*)"], |
| 1198 | dims=["Y"], |
| 1199 | ).astype(dtype) |
| 1200 | pat_re = value.str._re_compile(pat=pat_str) |
| 1201 | |
| 1202 | expected_list = [ |
| 1203 | [[["a", "0"]], [["", ""]]], |
| 1204 | [[["", ""]], [["ab", "10"]]], |
| 1205 | [[["abc", "01"]], [["", ""]]], |
| 1206 | ] |
| 1207 | expected = xr.DataArray(expected_list, dims=["X", "Y", "ZX", "ZY"]).astype(dtype) |
| 1208 | |
| 1209 | res_str = value.str.extractall(pat=pat_str, group_dim="ZX", match_dim="ZY") |
| 1210 | res_re = value.str.extractall(pat=pat_re, group_dim="ZX", match_dim="ZY") |
| 1211 | |
| 1212 | assert res_str.dtype == expected.dtype |
| 1213 | assert res_re.dtype == expected.dtype |
| 1214 | |
| 1215 | assert_equal(res_str, expected) |
| 1216 | assert_equal(res_re, expected) |
| 1217 | |
| 1218 | |
| 1219 | def test_findall_single_single_case(dtype) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…