From dae94d0ae743c6825049b0402f8fc06a6426cdfe Mon Sep 17 00:00:00 2001 From: Reeba Qureshi Date: Wed, 6 Nov 2024 14:14:26 +0530 Subject: [PATCH] add expected blocks --- .../apache_beam/yaml/examples/bigtable_enrichment.yaml | 7 +++++-- .../yaml/examples/enrich_spanner_with_bigquery.yaml | 3 +++ .../apache_beam/yaml/examples/testing/examples_test.py | 10 ++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sdks/python/apache_beam/yaml/examples/bigtable_enrichment.yaml b/sdks/python/apache_beam/yaml/examples/bigtable_enrichment.yaml index daaafe0d4031..788b69de7857 100644 --- a/sdks/python/apache_beam/yaml/examples/bigtable_enrichment.yaml +++ b/sdks/python/apache_beam/yaml/examples/bigtable_enrichment.yaml @@ -48,5 +48,8 @@ pipeline: # We can also store it somewhere like a json file - type: LogForTesting - # Expected: - # Row(sale_id = 1, customer_id = 1, product_id = 1, quantity = 1, product = Row(product_id: "1", product_name = "pixel 5", product_stock = "2")) +options: + yaml_experimental_features: Enrichment + +# Expected: +# Row(sale_id=1, customer_id=1, product_id=1, quantity=1, product={'product_id': '1', 'product_name': 'pixel 5', 'product_stock': '2'}) \ No newline at end of file diff --git a/sdks/python/apache_beam/yaml/examples/enrich_spanner_with_bigquery.yaml b/sdks/python/apache_beam/yaml/examples/enrich_spanner_with_bigquery.yaml index 96ddd65afa06..56d1408f0818 100644 --- a/sdks/python/apache_beam/yaml/examples/enrich_spanner_with_bigquery.yaml +++ b/sdks/python/apache_beam/yaml/examples/enrich_spanner_with_bigquery.yaml @@ -94,3 +94,6 @@ pipeline: config: path: 'errors.json' +# Expected: +# Row(customer_id=1001, customer_name='Alice', customer_email='alice@gmail.com', product_id=2001, order_date='24-03-24', order_amount=150) +# Row(customer_id=1003, customer_name='Claire', customer_email='claire@gmail.com', product_id=2003, order_date='7-05-24', order_amount=110) diff --git a/sdks/python/apache_beam/yaml/examples/testing/examples_test.py b/sdks/python/apache_beam/yaml/examples/testing/examples_test.py index df21b922d609..8f76e0a1e969 100644 --- a/sdks/python/apache_beam/yaml/examples/testing/examples_test.py +++ b/sdks/python/apache_beam/yaml/examples/testing/examples_test.py @@ -155,8 +155,14 @@ def _wordcount_test_preprocessor( env.input_file('kinglear.txt', '\n'.join(lines))) -@YamlExamplesTestSuite.register_test_preprocessor( - ['test_simple_filter_yaml', 'test_simple_filter_and_combine_yaml', 'test_spanner_read_yaml', 'test_spanner_write_yaml']) +@YamlExamplesTestSuite.register_test_preprocessor([ + 'test_simple_filter_yaml', + 'test_simple_filter_and_combine_yaml', + 'test_spanner_read_yaml', + 'test_spanner_write_yaml', + 'test_bigtable_enrichment_yaml', + 'test_enrich_spanner_with_bigquery_yaml' +]) def _file_io_write_test_preprocessor( test_spec: dict, expected: List[str], env: TestEnvironment):