(func)
| 4488 | |
| 4489 | @pytest.mark.parametrize("func", [np.asarray, M.to_records]) |
| 4490 | def test_map_partition_array(func): |
| 4491 | from dask.array.utils import assert_eq |
| 4492 | |
| 4493 | df = pd.DataFrame( |
| 4494 | {"x": [1, 2, 3, 4, 5], "y": [6.0, 7.0, 8.0, 9.0, 10.0]}, |
| 4495 | index=["a", "b", "c", "d", "e"], |
| 4496 | ) |
| 4497 | ddf = dd.from_pandas(df, npartitions=2) |
| 4498 | |
| 4499 | for pre in [lambda a: a, lambda a: a.x, lambda a: a.y, lambda a: a.index]: |
| 4500 | try: |
| 4501 | expected = func(pre(df)) |
| 4502 | except Exception: |
| 4503 | continue |
| 4504 | x = pre(ddf).map_partitions(func) |
| 4505 | assert_eq(x, expected, check_type=False) # TODO: make check_type pass |
| 4506 | |
| 4507 | assert isinstance(x, da.Array) |
| 4508 | assert x.chunks[0] == (np.nan, np.nan) |
| 4509 | |
| 4510 | |
| 4511 | def test_map_partition_sparse(): |
nothing calls this directly
no test coverage detected