(func)
| 4501 | |
| 4502 | @pytest.mark.parametrize("func", [np.asarray, M.to_records]) |
| 4503 | def test_map_partition_array(func): |
| 4504 | from dask.array.utils import assert_eq |
| 4505 | |
| 4506 | df = pd.DataFrame( |
| 4507 | {"x": [1, 2, 3, 4, 5], "y": [6.0, 7.0, 8.0, 9.0, 10.0]}, |
| 4508 | index=["a", "b", "c", "d", "e"], |
| 4509 | ) |
| 4510 | ddf = dd.from_pandas(df, npartitions=2) |
| 4511 | |
| 4512 | for pre in [lambda a: a, lambda a: a.x, lambda a: a.y, lambda a: a.index]: |
| 4513 | try: |
| 4514 | expected = func(pre(df)) |
| 4515 | except Exception: |
| 4516 | continue |
| 4517 | x = pre(ddf).map_partitions(func) |
| 4518 | assert_eq(x, expected, check_type=False) # TODO: make check_type pass |
| 4519 | |
| 4520 | assert isinstance(x, da.Array) |
| 4521 | assert x.chunks[0] == (np.nan, np.nan) |
| 4522 | |
| 4523 | |
| 4524 | def test_map_partition_sparse(): |
nothing calls this directly
no test coverage detected