Esempio n. 1
0
def test_dict_like():
    a = A()
    b = f(a)
    result = run_process(b, 1, serial.base)

    assert isinstance(result, A)
    assert result['value'] == 5
Esempio n. 2
0
def test_dict_like():
    a = A()
    b = f(a)
    result = run_process(b, 1, serial.base)

    assert isinstance(result, A)
    assert result['value'] == 5
Esempio n. 3
0
def test_globals():
    a = checker()
    result = run_process(a,
                         n_processes=1,
                         registry=serial.base,
                         init=init,
                         finish=finish)
    assert result
Esempio n. 4
0
def test_globals():
    """Test init and finish functions on ``run_process``."""
    a = checker()
    result = run_process(a,
                         n_processes=1,
                         registry=serial.base,
                         init=init,
                         finish=finish)
    assert result
Esempio n. 5
0
def test_storable():
    a = A()
    b = A()

    a.x = 1
    b.x = f(3, 4)

    c = g(a, lift(b))
    b.x = c
    d = h(lift(b), a)

    result = run_process(d, n_processes=1, registry=serial.base)
    assert result.x == 7
Esempio n. 6
0
def test_storable():
    a = A()
    b = A()

    a.x = 1
    b.x = f(3, 4)

    c = g(a, lift(b))
    b.x = c
    d = h(lift(b), a)

    result = run_process(d, n_processes=1, registry=serial.base)
    assert result.x == 7
Esempio n. 7
0
def test_find_first():
    global counter

    wfs = [counted_sqr(x) for x in range(10)]
    w = find_first(is_sixteen, wfs)
    result = run_single(w)
    assert result == 16
    assert counter == 5

    wfs = [counted_sqr(x) for x in range(10)]
    w = find_first(is_sixteen, wfs)
    result = run_process(w, n_processes=1, registry=base)
    assert result == 16

    wfs = [display_sqr(x) for x in range(10)]
    w = find_first(is_sixteen, wfs)
    with NCDisplay() as display:
        result = run_logging(w, n_threads=2, display=display)
    assert result == 16
Esempio n. 8
0
def test_find_first():
    global counter

    wfs = [counted_sqr(x) for x in range(10)]
    w = find_first(is_sixteen, wfs)
    result = run_single(w)
    assert result == 16
    assert counter == 5

    wfs = [counted_sqr(x) for x in range(10)]
    w = find_first(is_sixteen, wfs)
    result = run_process(w, n_processes=1, registry=base)
    assert result == 16

    wfs = [display_sqr(x) for x in range(10)]
    w = find_first(is_sixteen, wfs)
    with NCDisplay() as display:
        result = run_logging(w, n_threads=2, display=display)
    assert result == 16
Esempio n. 9
0
def test_class_methods_01():
    a = A(7)
    b = a(6)

    result = run_process(b, 1, registry)
    assert result == 42
Esempio n. 10
0
def test_class_methods_01():
    a = A(7)
    b = a(6)

    result = run_process(b, 1, registry)
    assert result == 42
Esempio n. 11
0
def test_capture_output():
    a = writes_to_stdout()
    result = run_process(a, n_processes=1, registry=serial.base, use_msgpack=True)
    assert result == 42
Esempio n. 12
0
 def run(wf):
     return noodles.run_process(wf, n_processes=4, registry=serial_registry)
Esempio n. 13
0
def test_class_decorator_process():
    a = make_object(A, 5).multiply(10)
    a.second = 7
    result = run_process(a, n_processes=1, registry=registry)
    assert result.value == 50
    assert result.second == 7
Esempio n. 14
0
def test_globals():
    a = checker()
    result = run_process(a, n_processes=1, registry=serial.base,
                         init=init, finish=finish)
    assert result
Esempio n. 15
0
def test_recursion_process():
    f100 = factorial(50.0)
    result = run_process(f100, n_processes=1, registry=registry, verbose=False)
    print(result)
    assert floor(log(result)) == 148