コード例 #1
0
    def testNoIncludeOrExcludeFilters(self):
        with beam.Pipeline() as pipeline:
            got = (pipeline
                   | 'Create' >> beam.Create([{
                       constants.INPUT_KEY: 'input',
                       'other': 2
                   }])
                   | 'EvaluateExtracts' >>
                   analysis_table_evaluator.EvaluateExtracts())

            def check_result(got):
                try:
                    self.assertEqual(got, [{'other': 2}])
                except AssertionError as err:
                    raise util.BeamAssertException(err)

            util.assert_that(got[constants.ANALYSIS_KEY], check_result)
コード例 #2
0
    def testExcludeFilter(self):
        with beam.Pipeline() as pipeline:
            got = (pipeline
                   | 'Create' >> beam.Create([{
                       'a': 1,
                       'b': 2
                   }])
                   | 'EvaluateExtracts' >>
                   analysis_table_evaluator.EvaluateExtracts(exclude=['a']))

            def check_result(got):
                try:
                    self.assertEqual(got, [{'b': 2}])
                except AssertionError as err:
                    raise util.BeamAssertException(err)

            util.assert_that(got[constants.ANALYSIS_KEY], check_result)