MCPcopy
hub / github.com/dask/dask / test_visualize

Function test_visualize

dask/tests/test_base.py:546–584  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

544 strict=False,
545)
546def test_visualize():
547 pytest.importorskip("graphviz")
548 pytest.importorskip("ipycytoscape")
549 with tmpdir() as d:
550 x = da.arange(5, chunks=2)
551 x.visualize(filename=os.path.join(d, "mydask"))
552 assert os.path.exists(os.path.join(d, "mydask.png"))
553
554 x.visualize(filename=os.path.join(d, "mydask.pdf"))
555 assert os.path.exists(os.path.join(d, "mydask.pdf"))
556
557 visualize(x, 1, 2, filename=os.path.join(d, "mydask.png"))
558 assert os.path.exists(os.path.join(d, "mydask.png"))
559
560 dsk = {"a": 1, "b": (add, "a", 2), "c": (mul, "a", 1)}
561 visualize(x, dsk, filename=os.path.join(d, "mydask.png"))
562 assert os.path.exists(os.path.join(d, "mydask.png"))
563
564 x = Tuple(dsk, ["a", "b", "c"])
565 visualize(x, filename=os.path.join(d, "mydask.png"))
566 assert os.path.exists(os.path.join(d, "mydask.png"))
567
568 x = Tuple(dsk, ["a", "b", "c"])
569 visualize(x, filename=os.path.join(d, "cyt"), engine="cytoscape")
570 assert os.path.exists(os.path.join(d, "cyt.html"))
571
572 visualize(x, filename=os.path.join(d, "cyt2.html"), engine="ipycytoscape")
573 assert os.path.exists(os.path.join(d, "cyt2.html"))
574
575 with dask.config.set(visualization__engine="cytoscape"):
576 visualize(x, filename=os.path.join(d, "cyt3.html"))
577 assert os.path.exists(os.path.join(d, "cyt3.html"))
578
579 with pytest.raises(ValueError, match="not-real"):
580 visualize(x, engine="not-real")
581
582 # To see if visualize() works when the filename parameter is set to None
583 # If the function raises an error, the test will fail
584 x.visualize(filename=None)
585
586
587@pytest.mark.skipif("not da")

Callers

nothing calls this directly

Calls 7

tmpdirFunction · 0.90
visualizeFunction · 0.90
setMethod · 0.80
TupleClass · 0.70
arangeMethod · 0.45
visualizeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…