Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions sdks/python/apache_beam/yaml/yaml_transform_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,35 @@ def test_expand_pipeline_with_incorrect_pipelines_key_fails(self):
with self.assertRaises(KeyError):
expand_pipeline(p, spec, validate_schema=None)

@unittest.skipIf(jsonschema is None, "Yaml dependencies not installed")
def test_expand_pipeline_with_valid_schema(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='generic')

@unittest.skipIf(jsonschema is None, "Yaml dependencies not installed")
def test_expand_pipeline_with_invalid_schema(self):
spec = '''
pipeline:
type: chain
transforms:
- name: Create
config:
elements: [1,2,3]
- type: LogForTesting
'''
with new_pipeline() as p:
with self.assertRaises(jsonschema.ValidationError):
expand_pipeline(p, spec, validate_schema='generic')


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
Expand Down
Loading