예제 #1
0
 def test_complete(self):
     xform = xf.comp(xf.replace({1: 'one'}), xf.partition_all(2))
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3])), [('one', 2), (3,)])
예제 #2
0
 def test_arity_zero(self):
     self.assertEqual(xf.replace({})(lambda: 'success')(), 'success')
예제 #3
0
 def test_empty(self):
     xform = xf.replace({1: 'one'})
     self.assertEqual(list(xf.xiter(xform, [])), [])
예제 #4
0
 def test_reduced(self):
     xform = xf.comp(xf.replace({1: 'one'}), xf.take(2))
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3, 4])), ['one', 2])
예제 #5
0
 def test_replace_some(self):
     xform = xf.replace({1: 'one', 2: 'two'})
     self.assertEqual(list(xf.xiter(xform, [1, 2, 3])), ['one', 'two', 3])