liferoad commented on code in PR #36087: URL: https://github.com/apache/beam/pull/36087#discussion_r2331222335
########## sdks/python/apache_beam/yaml/yaml_transform_unit_test.py: ########## @@ -988,6 +989,69 @@ def test_init_with_dict(self): self.assertEqual(result._spec['type'], "composite") # preprocessed spec +class ExpandPipelineTest(unittest.TestCase): + def test_expand_pipeline_with_pipeline_key_only(self): + spec = ''' + pipeline: + type: chain + transforms: + - type: Create + config: + elements: [1,2,3] + - type: LogForTesting + ''' + with new_pipeline() as p: + expand_pipeline(p, spec, validate_schema=None) + + def test_expand_pipeline_with_pipeline_and_option_keys(self): + spec = ''' + pipeline: + type: chain + transforms: + - type: Create + config: + elements: [1,2,3] + - type: LogForTesting + options: + streaming: false + ''' + with new_pipeline() as p: + expand_pipeline(p, spec, validate_schema=None) + + def test_expand_pipeline_with_extra_top_level_keys(self): + spec = ''' + template: + version: "1.0" + author: "test_user" + + pipeline: + type: chain + transforms: + - type: Create + config: + elements: [1,2,3] + - type: LogForTesting + + other_metadata: "This is an ignored comment." + ''' + with new_pipeline() as p: + expand_pipeline(p, spec, validate_schema=None) + + def test_expand_pipeline_with_incorrect_pipelines_key_fails(self): + spec = ''' + pipelines: + type: chain + transforms: + - type: Create + config: + elements: [1,2,3] + - type: LogForTesting + ''' + with new_pipeline() as p: + with self.assertRaises(KeyError): + expand_pipeline(p, spec, validate_schema=None) Review Comment: shall we test `validate_schema` or is it fine for now? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org