Ejemplo n.º 1
0
def test_invert_links():
    A = value(1)
    B = value(2)
    C = add(A, B)

    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)

    assert is_workflow(C)
    assert C.nodes[C.root].bound_args.args == (Empty, Empty)
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'a', None)) \
        in C.links[A.root]
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'b', None)) \
        in C.links[B.root]

    deps = invert_links(C.links)
    assert deps == {
        A.root: {},
        B.root: {},
        C.root: {
            ArgumentAddress(ArgumentKind.regular, 'a', None): A.root,
            ArgumentAddress(ArgumentKind.regular, 'b', None): B.root
        }
    }
Ejemplo n.º 2
0
def test_with_keywords():
    A = value(1)
    B = value(2)
    C = takes_keywords(a=A, b=B, s="regular!")
    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)

    assert is_workflow(C)
    assert C.nodes[C.root].bound_args.args == ("regular!",)
    assert C.nodes[C.root].bound_args.kwargs == {'a': Empty, 'b': Empty}
Ejemplo n.º 3
0
def test_with_keywords():
    A = value(1)
    B = value(2)
    C = takes_keywords(a=A, b=B, s="regular!")
    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)

    assert is_workflow(C)
    assert C.nodes[C.root].bound_args.args == ("regular!", )
    assert C.nodes[C.root].bound_args.kwargs == {'a': Empty, 'b': Empty}
Ejemplo n.º 4
0
def test_merge_workflow():
    A = value(1)
    B = value(2)
    C = add(A, B)

    assert is_workflow(C)
    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)
    assert C.nodes[C.root].bound_args.args == (Empty, Empty)
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'a', None)) \
        in C.links[A.root]
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'b', None)) \
        in C.links[B.root]
Ejemplo n.º 5
0
def test_merge_workflow():
    A = value(1)
    B = value(2)
    C = add(A, B)

    assert is_workflow(C)
    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)
    assert C.nodes[C.root].bound_args.args == (Empty, Empty)
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'a', None)) \
        in C.links[A.root]
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'b', None)) \
        in C.links[B.root]
Ejemplo n.º 6
0
def test_binder():
    A = value(1)
    B = value(2)
    C = gather(A, B)

    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)

    assert is_workflow(C)
    assert C.nodes[C.root].bound_args.args == (Empty, Empty)
    assert (C.root, ArgumentAddress(ArgumentKind.variadic, 'a', 0)) \
        in C.links[A.root]
    assert (C.root, ArgumentAddress(ArgumentKind.variadic, 'a', 1)) \
        in C.links[B.root]
Ejemplo n.º 7
0
def test_binder():
    A = value(1)
    B = value(2)
    C = gather(A, B)

    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)

    assert is_workflow(C)
    assert C.nodes[C.root].bound_args.args == (Empty, Empty)
    assert (C.root, ArgumentAddress(ArgumentKind.variadic, 'a', 0)) \
        in C.links[A.root]
    assert (C.root, ArgumentAddress(ArgumentKind.variadic, 'a', 1)) \
        in C.links[B.root]
Ejemplo n.º 8
0
def test_invert_links():
    A = value(1)
    B = value(2)
    C = add(A, B)

    C = get_workflow(C)
    A = get_workflow(A)
    B = get_workflow(B)

    assert is_workflow(C)
    assert C.nodes[C.root].bound_args.args == (Empty, Empty)
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'a', None)) \
        in C.links[A.root]
    assert (C.root, ArgumentAddress(ArgumentKind.regular, 'b', None)) \
        in C.links[B.root]

    deps = invert_links(C.links)
    assert deps == {
        A.root: {},
        B.root: {},
        C.root: {
            ArgumentAddress(ArgumentKind.regular, 'a', None): A.root,
            ArgumentAddress(ArgumentKind.regular, 'b', None): B.root}}
Ejemplo n.º 9
0
def test_is_workflow():
    assert is_workflow(Workflow(root=None, nodes={}, links={}))
Ejemplo n.º 10
0
def test_is_workflow():
    assert is_workflow(Workflow(root=None, nodes={}, links={}))