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

Function test_visualize

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

Source from the content-addressed store, hash-verified

533 strict=False,
534)
535def test_visualize():
536 pytest.importorskip("graphviz")
537 pytest.importorskip("ipycytoscape")
538 with tmpdir() as d:
539 x = da.arange(5, chunks=2)
540 x.visualize(filename=os.path.join(d, "mydask"))
541 assert os.path.exists(os.path.join(d, "mydask.png"))
542
543 x.visualize(filename=os.path.join(d, "mydask.pdf"))
544 assert os.path.exists(os.path.join(d, "mydask.pdf"))
545
546 visualize(x, 1, 2, filename=os.path.join(d, "mydask.png"))
547 assert os.path.exists(os.path.join(d, "mydask.png"))
548
549 dsk = {"a": 1, "b": (add, "a", 2), "c": (mul, "a", 1)}
550 visualize(x, dsk, filename=os.path.join(d, "mydask.png"))
551 assert os.path.exists(os.path.join(d, "mydask.png"))
552
553 x = Tuple(dsk, ["a", "b", "c"])
554 visualize(x, filename=os.path.join(d, "mydask.png"))
555 assert os.path.exists(os.path.join(d, "mydask.png"))
556
557 x = Tuple(dsk, ["a", "b", "c"])
558 visualize(x, filename=os.path.join(d, "cyt"), engine="cytoscape")
559 assert os.path.exists(os.path.join(d, "cyt.html"))
560
561 visualize(x, filename=os.path.join(d, "cyt2.html"), engine="ipycytoscape")
562 assert os.path.exists(os.path.join(d, "cyt2.html"))
563
564 with dask.config.set(visualization__engine="cytoscape"):
565 visualize(x, filename=os.path.join(d, "cyt3.html"))
566 assert os.path.exists(os.path.join(d, "cyt3.html"))
567
568 with pytest.raises(ValueError, match="not-real"):
569 visualize(x, engine="not-real")
570
571 # To see if visualize() works when the filename parameter is set to None
572 # If the function raises an error, the test will fail
573 x.visualize(filename=None)
574
575
576@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