Skip to content

Commit 335e96b

Browse files
authored
[yaml] : Add final expand pipeline ut (#37260)
* Add final exand pipeline ut * add gemini recommendation
1 parent 990276f commit 335e96b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

sdks/python/apache_beam/yaml/yaml_transform_unit_test.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,35 @@ def test_expand_pipeline_with_incorrect_pipelines_key_fails(self):
10991099
with self.assertRaises(KeyError):
11001100
expand_pipeline(p, spec, validate_schema=None)
11011101

1102+
@unittest.skipIf(jsonschema is None, "Yaml dependencies not installed")
1103+
def test_expand_pipeline_with_valid_schema(self):
1104+
spec = '''
1105+
pipeline:
1106+
type: chain
1107+
transforms:
1108+
- type: Create
1109+
config:
1110+
elements: [1,2,3]
1111+
- type: LogForTesting
1112+
'''
1113+
with new_pipeline() as p:
1114+
expand_pipeline(p, spec, validate_schema='generic')
1115+
1116+
@unittest.skipIf(jsonschema is None, "Yaml dependencies not installed")
1117+
def test_expand_pipeline_with_invalid_schema(self):
1118+
spec = '''
1119+
pipeline:
1120+
type: chain
1121+
transforms:
1122+
- name: Create
1123+
config:
1124+
elements: [1,2,3]
1125+
- type: LogForTesting
1126+
'''
1127+
with new_pipeline() as p:
1128+
with self.assertRaises(jsonschema.ValidationError):
1129+
expand_pipeline(p, spec, validate_schema='generic')
1130+
11021131

11031132
if __name__ == '__main__':
11041133
logging.getLogger().setLevel(logging.INFO)

0 commit comments

Comments
 (0)