

def test_parloop_should_set_ro_flag(self, backend, elems, x):
    'Assert that a par_loop locks each Dat argument for writing.'
    kernel = 'void k(unsigned int *x) { *x = 1; }'
    x_data = x.data_with_halos
    op2.par_loop(op2.Kernel(kernel, 'k'), elems, x(op2.WRITE))
    op2.base._trace.evaluate(set([x]), set())
    with pytest.raises((RuntimeError, ValueError)):
        x_data[0] = 1

dataset/ETHPy150Open OP2/PyOP2/test/unit/test_direct_loop.py TestDirectLoop.test_parloop_should_set_ro_flag/original