def test_counting_with_predicate(self): result = transduce(transducer=counting(lambda w: 'o' in w), reducer=expecting_single(), iterable="The quick brown fox jumped".split()) self.assertEqual(result, 2)
def test_counting(self): result = transduce(transducer=counting(), reducer=expecting_single(), iterable="The quick brown fox jumped".split()) self.assertEqual(result, 5)