bzablocki commented on code in PR #26771:
URL: https://github.com/apache/beam/pull/26771#discussion_r1198250731


##########
sdks/python/apache_beam/yaml/yaml_transform_test.py:
##########
@@ -280,6 +280,50 @@ def test_windowing_on_outer(self):
           providers=TEST_PROVIDERS)
       assert_that(result, equal_to([6, 9]))
 
+  def test_name_is_not_ambiguous(self):
+    with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
+        pickle_library='cloudpickle')) as p:
+
+      result = p | YamlTransform(
+          '''
+          type: composite
+          transforms:
+            - type: Create
+              name: Create
+              elements: [0, 1, 3, 4]
+            - type: PyFilter
+              name: Filter
+              keep: "lambda elem: elem > 2"
+              input: Create
+          output: Filter
+          ''')
+      # No exception raised
+      assert_that(result, equal_to([3, 4]))
+
+  def test_name_is_ambiguous(self):
+    with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
+        pickle_library='cloudpickle')) as p:
+
+      with self.assertRaises(ValueError):
+        result = p | YamlTransform(
+            '''
+            type: composite
+            transforms:
+              - type: Create
+                name: CreateData
+                elements: [0, 1, 3, 4]
+              - type: PyFilter
+                name: PyFilter
+                keep: "lambda elem: elem > 2"
+                input: CreateData
+              - type: PyFilter
+                name: AnotherFilter
+                keep: "lambda elem: elem > 3"
+                input: PyFilter

Review Comment:
   @robertwb what do you think, should this raise an error? In my 
implementation it does.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to