MCPcopy Create free account
hub / github.com/dask/dask / test_assert_eq_scheduler

Function test_assert_eq_scheduler

dask/dataframe/tests/test_utils_dataframe.py:633–658  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

631
632
633def test_assert_eq_scheduler():
634 using_custom_scheduler = False
635
636 def custom_scheduler(*args, **kwargs):
637 nonlocal using_custom_scheduler
638 try:
639 using_custom_scheduler = True
640 return get_sync(*args, **kwargs)
641 finally:
642 using_custom_scheduler = False
643
644 def check_custom_scheduler(part: pd.DataFrame) -> pd.DataFrame:
645 assert using_custom_scheduler, "not using custom scheduler"
646 return part + 1
647
648 df = pd.DataFrame({"x": [1, 2, 3, 4]})
649 ddf = dd.from_pandas(df, npartitions=2)
650 ddf2 = ddf.map_partitions(check_custom_scheduler, meta=ddf)
651
652 with pytest.raises(AssertionError, match="not using custom scheduler"):
653 # NOTE: we compare `ddf2` to itself in order to test both sides of the `assert_eq` logic.
654 assert_eq(ddf2, ddf2)
655
656 assert_eq(ddf2, ddf2, scheduler=custom_scheduler)
657 with dask.config.set(scheduler=custom_scheduler):
658 assert_eq(ddf2, ddf2, scheduler=None)
659
660
661@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
setMethod · 0.80
map_partitionsMethod · 0.45

Tested by

no test coverage detected