Ejemplo n.º 1
0
 def test_complete(self):
     xform = xf.comp(xf.drop_while(lambda x: x < 3), xf.partition_all(2))
     dropped = list(xf.xiter(xform, range(8)))
     self.assertEqual(list(dropped), [(3, 4), (5, 6), (7,)])
Ejemplo n.º 2
0
 def test_arity_zero(self):
     self.assertEqual(xf.drop_while(None)(lambda: 'success')(), 'success')
Ejemplo n.º 3
0
 def test_pred_ignored_after_first_take(self):
     dropped = list(xf.xiter(xf.drop_while(lambda x: x < 3),
                             [1, 2, 3, -4, -5]))
     self.assertEqual(dropped, [3, -4, -5])
Ejemplo n.º 4
0
 def test_reduced(self):
     xform = xf.comp(xf.drop_while(lambda x: x < 3), xf.take(2))
     dropped = list(xf.xiter(xform, range(8)))
     self.assertEqual(list(dropped), [3, 4])
Ejemplo n.º 5
0
 def test_drop_none(self):
     dropped = list(xf.xiter(xf.drop_while(lambda x: x < 0), [1, 2, 3, 4]))
     self.assertEqual(dropped, [1, 2, 3, 4])