Repository: beam
Updated Branches:
  refs/heads/master 4d633bc5a -> 70aa0a4a4


Ensure that assert_that takes a PCollection as its first argument.

This can avoid (silent) error such as

    with test_pipeline.TestPipeline() as p:
      bad_value = "Create0" >> beam.Create([1])  # Note missing "p | "
      beam_util.assert_that(bad_value, beam_util.equal_to([0]))


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/4a963feb
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/4a963feb
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/4a963feb

Branch: refs/heads/master
Commit: 4a963feb8d12d81aedffc2933738f98e266ba916
Parents: 4d633bc
Author: Robert Bradshaw <rober...@gmail.com>
Authored: Thu Mar 9 16:18:46 2017 -0800
Committer: Ahmet Altay <al...@google.com>
Committed: Wed Mar 29 17:53:24 2017 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/transforms/util.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/4a963feb/sdks/python/apache_beam/transforms/util.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/util.py 
b/sdks/python/apache_beam/transforms/util.py
index ac7eb3c..a6ecf0a 100644
--- a/sdks/python/apache_beam/transforms/util.py
+++ b/sdks/python/apache_beam/transforms/util.py
@@ -20,6 +20,7 @@
 
 from __future__ import absolute_import
 
+from apache_beam import pvalue
 from apache_beam.transforms import window
 from apache_beam.transforms.core import CombinePerKey
 from apache_beam.transforms.core import Create
@@ -219,6 +220,7 @@ def assert_that(actual, matcher, label='assert_that'):
   Returns:
     Ignored.
   """
+  assert isinstance(actual, pvalue.PCollection)
 
   class AssertThat(PTransform):
 

Reply via email to