Exemple #1
0
def test_no_transform():
    dag = DAG(concurrent.futures.ThreadPoolExecutor())
    output = dag.add_input([2])
    assert list(dag.compute(output)) == [2]
Exemple #2
0
def test_dag_multiple_partitions():
    dag = DAG(concurrent.futures.ThreadPoolExecutor())
    input = dag.add_input([2, 3, 5])
    output = dag.transform(add_one, [input])
    assert list(dag.compute(output)) == [3, 4, 6]
Exemple #3
0
def test_dag_single_partition_serial_functions():
    dag = DAG(concurrent.futures.ThreadPoolExecutor())
    input = dag.add_input([2])
    intermediate = dag.transform(add_one, [input])
    output = dag.transform(times_two, [intermediate])
    assert list(dag.compute(output)) == [6]
Exemple #4
0
def test_dag_single_partition_binary_function():
    dag = DAG(concurrent.futures.ThreadPoolExecutor())
    input1 = dag.add_input([2])
    input2 = dag.add_input([3])
    output = dag.transform(add, [input1, input2])
    assert list(dag.compute(output)) == [5]
Exemple #5
0
def test_dag_multiple_partitions_binary_function():
    dag = DAG(concurrent.futures.ThreadPoolExecutor())
    input1 = dag.add_input([2, 3, 5])
    input2 = dag.add_input([7, 11, 13])
    output = dag.transform(add, [input1, input2])
    assert list(dag.compute(output)) == [9, 14, 18]