Exemple #1
0
 def test_arity_zero(self):
     self.assertEqual(xf.drop_last(1)(lambda: 'success')(), 'success')
Exemple #2
0
 def test_complete(self):
     xform = xf.comp(xf.drop_last(1), xf.partition_all(2))
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3, 4])), [(1, 2), (3,)])
Exemple #3
0
 def test_empty(self):
     xform = xf.drop_last(2)
     self.assertEqual(list(xf.xiter(xform, [])), [])
Exemple #4
0
 def test_reduced(self):
     xform = xf.comp(xf.drop_last(4), xf.take(2))
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3, 4, 5, 6, 7])), [1, 2])
Exemple #5
0
 def test_n_neg(self):
     xform = xf.drop_last(-1)
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3])), [1, 2, 3])
Exemple #6
0
 def test_n_zero(self):
     xform = xf.drop_last(0)
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3])), [1, 2, 3])
Exemple #7
0
 def test_n_fraction(self):
     xform = xf.drop_last(2.5)
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3, 4, 5])), [1, 2, 3])
Exemple #8
0
 def test_n_too_small(self):
     xform = xf.drop_last(2)
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3, 4, 5])), [1, 2, 3])
Exemple #9
0
 def test_n_too_large(self):
     xform = xf.drop_last(5)
     self.assertEqual(list(xf.xiter(xform, [1, 2])), [])