You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
579 B
29 lines
579 B
6 years ago
|
import os
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
import dask.array as da
|
||
|
from dask.utils_test import inc
|
||
|
from dask.highlevelgraph import HighLevelGraph
|
||
|
|
||
|
|
||
|
def test_visualize(tmpdir):
|
||
|
pytest.importorskip('graphviz')
|
||
|
fn = str(tmpdir)
|
||
|
a = da.ones(10, chunks=(5,))
|
||
|
b = a + 1
|
||
|
c = a + 2
|
||
|
d = b + c
|
||
|
d.dask.visualize(fn)
|
||
|
assert os.path.exists(fn)
|
||
|
|
||
|
|
||
|
def test_basic():
|
||
|
a = {'x': 1}
|
||
|
b = {'y': (inc, 'x')}
|
||
|
layers = {'a': a, 'b': b}
|
||
|
dependencies = {'a': set(), 'b': {'a'}}
|
||
|
hg = HighLevelGraph(layers, dependencies)
|
||
|
|
||
|
assert dict(hg) == {'x': 1, 'y': (inc, 'x')}
|