hjtran commented on code in PR #30771:
URL: https://github.com/apache/beam/pull/30771#discussion_r1548823514


##########
sdks/python/apache_beam/testing/util.py:
##########
@@ -261,6 +261,19 @@ def assert_that(
   """
   assert isinstance(actual, pvalue.PCollection), (
       '%s is not a supported type for Beam assert' % type(actual))
+  pipeline = actual.pipeline
+  if getattr(pipeline, 'result', None) is not None:
+    # The pipeline was already run. The user most likely called assert_that
+    # after the pipeleline context.
+    raise RuntimeError(
+        'assert_that must be used within a beam.Pipeline context')
+
+  # If label is already in use, just append a number to it.

Review Comment:
   I put:
   ```
     # Usually, the uniqueness of the label is left to the pipeline
     # writer to guarantee. Since we're in a testing context, we'll
     # just automatically append a number to the label if it's
     # already in use.
   ```
   Let me know if something else would be better



-- 
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

Reply via email to