Beispiel #1
0
    def test_run_e2e_beam(self):
        with test_pipeline.TestPipeline() as p:
            input = p | "Create input" >> beam.Create(list(range(10)))

            output = self.run_e2e_private_partition_selection_large_budget(
                input, pipeline_dp.BeamBackend())

            beam_util.assert_that(output, beam_util.is_not_empty())
Beispiel #2
0
  def test_create_predict(self):
    USER_EVENT = {"event_type": "page-visit", "user_info": {"visitor_id": "1"}}

    with TestPipeline(is_integration_test=True) as p:
      output = (
          p | 'Create data' >> beam.Create([USER_EVENT])
          | 'Predict UserEvent' >> recommendations_ai.PredictUserEvent(
              project=p.get_option('project'),
              placement_id="recently_viewed_default")
          | beam.ParDo(extract_prediction))

      assert_that(output, is_not_empty())
Beispiel #3
0
 def test_assert_that_fails_on_is_not_empty_expected(self):
   with self.assertRaises(BeamAssertException):
     with TestPipeline() as p:
       assert_that(p | Create([]), is_not_empty())
Beispiel #4
0
 def test_assert_that_passes_is_not_empty(self):
   with TestPipeline() as p:
     assert_that(p | Create([1, 2, 3]), is_not_empty())