Beispiel #1
0
 def inject_inc(dsk):
     assert isinstance(dsk, BasicLayer)
     dsk = dict(dsk)
     k = next(iter(dsk))
     dsk[k] = (inc, dsk[k])
     if inject_dict:
         return dsk  # map_basic_layers() should automatically convert it to a `BasicLayer`
     else:
         return BasicLayer(dsk)
Beispiel #2
0
def test_cull():
    a = {"x": 1, "y": (inc, "x")}
    layers = {"a": BasicLayer(a)}
    dependencies = {"a": set()}
    hg = HighLevelGraph(layers, dependencies)

    culled_by_x = hg.cull({"x"})
    assert dict(culled_by_x) == {"x": 1}

    culled_by_y = hg.cull({"y"})
    assert dict(culled_by_y) == a
Beispiel #3
0
def test_highlevelgraph_dicts_deprecation():
    with pytest.warns(FutureWarning):
        layers = {"a": BasicLayer({"x": 1, "y": (inc, "x")})}
        hg = HighLevelGraph(layers, {"a": set()})
        assert hg.dicts == layers