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