def test_block_exec(): # This function tricky to test in a multiprocessing world, because we need # some way to communicate back from the subprocesses that the execution # actually happened... instead we just test it in serial # mode. (Fortunately it is a super-trivial function.) z = ZS(test_data_path("letters-none.zs"), parallelism=0) # b/c we're in serial mode, the fn doesn't need to be pickleable class CountBlocks(object): def __init__(self): self.count = 0 def __call__(self, records): self.count += 1 count_blocks = CountBlocks() z.block_exec(count_blocks) assert count_blocks.count > 1 assert count_blocks.count == len(list(z.block_map(identity)))