示例#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,)])
示例#2
0
 def test_arity_zero(self):
     self.assertEqual(xf.filter_indexed(None)(lambda: 'success')(),
                      'success')
示例#3
0
 def test_empty(self):
     xform = xf.filter_indexed(lambda i, v: True)
     self.assertEqual(list(xf.xiter(xform, [])), [])
示例#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])
示例#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])