예제 #1
0
 def test_callable_k(self):
   with TestPipeline() as p:
     pc = p | beam.Create(self.l)
     with_keys = pc | util.WithKeys(lambda x: x*x)
   assert_that(with_keys, equal_to([(1, 1), (4, 2), (9, 3)]))
예제 #2
0
 def test_constant_k(self):
   with TestPipeline() as p:
     pc = p | beam.Create(self.l)
     with_keys = pc | util.WithKeys('k')
   assert_that(with_keys, equal_to([('k', 1), ('k', 2), ('k', 3)], ))