コード例 #1
0
def test_io_call():
    context.set_pycompss_context(context.MASTER)
    my_io = IO()
    f = my_io(dummy_function)
    result = f()
    context.set_pycompss_context(context.OUT_OF_SCOPE)
    assert result == 1, "Wrong expected result (should be 1)."
コード例 #2
0
def test_io_existing_core_element():
    context.set_pycompss_context(context.MASTER)
    my_io = IO()
    f = my_io(dummy_function)
    # a higher level decorator would place the compss core element as follows:
    _ = f(compss_core_element=CE())
    assert CORE_ELEMENT_KEY not in my_io.kwargs, \
           "Core Element is not defined in kwargs dictionary."
コード例 #3
0
def test_io_call_outside():
    context.set_pycompss_context(context.OUT_OF_SCOPE)
    my_io = IO()
    f = my_io(dummy_function)
    thrown = False
    try:
        _ = f()
    except Exception:  # noqa
        thrown = True  # this is OK!
    assert thrown, \
        "The ompss decorator did not raise an exception when invoked out of scope."  # noqa: E501
コード例 #4
0
def test_io_instantiation():
    context.set_pycompss_context(context.MASTER)
    my_io = IO()
    context.set_pycompss_context(context.OUT_OF_SCOPE)
    assert my_io.decorator_name == "@io", "The decorator name must be @io."