def test_ctxrange(self): a = parallel.shzeros([32], dtype=int) with parallel.ctxrange('test', len(a)) as r: for i in r: a[i] = 1 time.sleep(.01) self.assertEqual(a.tolist(), [1]*len(a))
def test_shzeros(self): a = parallel.shzeros([3], dtype=int) with parallel.fork() as procid: a[procid] = 1 self.assertEqual(a.tolist(), [1,1,1] if canfork else [1,0,0])