def test_15(self): data = range(1, 10) _mult = Stream(data).collect(Reduce(bi_func=op.mul)) self.assertTrue(_mult.present()) self.assertEqual(_mult.get(), factorial(9))
def test_14(self): data = range(10) _sum = Stream(data).collect(Reduce(bi_func=op.add)) self.assertTrue(_sum.present()) self.assertEqual(_sum.get(), sum(data))