Exemple #1
0
 def test_complete(self):
     xform = xf.comp(xf.filter_indexed(self.even_i_pos_v),
                     xf.partition_all(2))
     self.assertEqual(list(xf.xiter(xform, [-1, 2, 3, 4, 5, 6, 7])),
                      [(3, 5), (7,)])
Exemple #2
0
 def test_arity_zero(self):
     self.assertEqual(xf.filter_indexed(None)(lambda: 'success')(),
                      'success')
Exemple #3
0
 def test_empty(self):
     xform = xf.filter_indexed(lambda i, v: True)
     self.assertEqual(list(xf.xiter(xform, [])), [])
Exemple #4
0
 def test_reduced(self):
     xform = xf.comp(xf.filter_indexed(self.even_i_pos_v), xf.take(1))
     self.assertEqual(list(xf.xiter(xform, [-1, 2, 3, 4, 5])), [3])
Exemple #5
0
 def test_not_empty(self):
     xform = xf.filter_indexed(self.even_i_pos_v)
     self.assertEqual(list(xf.xiter(xform, [-1, 2, 3, 4, 5])), [3, 5])