コード例 #1
0
ファイル: test_eager.py プロジェクト: xgid/python-transducers
 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)
コード例 #2
0
 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)
コード例 #3
0
ファイル: test_eager.py プロジェクト: xgid/python-transducers
 def test_counting(self):
     result = transduce(transducer=counting(),
                        reducer=expecting_single(),
                        iterable="The quick brown fox jumped".split())
     self.assertEqual(result, 5)
コード例 #4
0
 def test_counting(self):
     result = transduce(transducer=counting(),
                        reducer=expecting_single(),
                        iterable="The quick brown fox jumped".split())
     self.assertEqual(result, 5)