def test_choice(self): arr = Arrow() prog = arr.choice_apply(1, _plus1) prog.post(list) self.assertEquals([0, 1, 1, 0], prog([0, 0, 1, 0])) arr = Arrow() prog = arr.choice_apply(1, _fn_with_args, 1, 2) prog.post(list) self.assertEquals([0, 3, 1, 0], prog([0, 0, 1, 0]))
def test_parallel(self): """***""" prog = Arrow().parallel(lambda n: n+1, lambda n: n+2) prog.post(list) self.assertEquals([2, 4], prog([1, 2]))
def test_precomputation(self): arr = Arrow().map(lambda n: n+1) larger2arr = arr.filter(lambda n: n>2) self.assertEquals([3,4,5,6,7, 8], larger2arr([1,2,3,4,5,6,7]))
def test_choice(self): arr = Arrow() prog = arr.choice(_plus1, 1) self.assertEquals([0, 1, 0, 0], prog([0, 0, 0, 0]))