예제 #1
0
 def test_arity_zero(self):
     self.assertEqual(xf.drop_last(1)(lambda: 'success')(), 'success')
예제 #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,)])
예제 #3
0
 def test_empty(self):
     xform = xf.drop_last(2)
     self.assertEqual(list(xf.xiter(xform, [])), [])
예제 #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])
예제 #5
0
 def test_n_neg(self):
     xform = xf.drop_last(-1)
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3])), [1, 2, 3])
예제 #6
0
 def test_n_zero(self):
     xform = xf.drop_last(0)
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3])), [1, 2, 3])
예제 #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])
예제 #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])
예제 #9
0
 def test_n_too_large(self):
     xform = xf.drop_last(5)
     self.assertEqual(list(xf.xiter(xform, [1, 2])), [])