You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2017/10/12 22:54:40 UTC

[04/18] beam git commit: Change the ptransform_test to use assertEqual rather than assertTrue for improved debugging, fix the error message we're looking for since we now throw a tuple exception instead

Change the ptransform_test to use assertEqual rather than assertTrue for improved debugging, fix the error message we're looking for since we now throw a tuple exception instead


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

Branch: refs/heads/master
Commit: 5cc6b5f17e0e1e117a8cd237d4c7be8d7fce8a17
Parents: 7d0040d
Author: Holden Karau <ho...@us.ibm.com>
Authored: Fri Sep 1 20:49:40 2017 -0700
Committer: Robert Bradshaw <ro...@gmail.com>
Committed: Thu Oct 12 15:50:08 2017 -0700

----------------------------------------------------------------------
 .../apache_beam/transforms/ptransform_test.py       | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/5cc6b5f1/sdks/python/apache_beam/transforms/ptransform_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/ptransform_test.py b/sdks/python/apache_beam/transforms/ptransform_test.py
index c137b14..2f2734d 100644
--- a/sdks/python/apache_beam/transforms/ptransform_test.py
+++ b/sdks/python/apache_beam/transforms/ptransform_test.py
@@ -1332,9 +1332,11 @@ class PTransformTypeCheckTestCase(TypeHintTestCase):
     self.assertStartswith(
         e.exception.message,
         "Runtime type violation detected within ParDo(Add): "
-        "Type-hint for argument: 'y' violated. "
-        "Expected an instance of <type 'int'>, "
-        "instead found 3.0, an instance of <type 'float'>.")
+        "Type-hint for argument: 'x_y' violated: "
+        "Tuple[int, int] hint type-constraint violated. "
+        "The type of element #1 in the passed tuple is incorrect. "
+        "Expected an instance of type int, instead received an instance "
+        "of type float.")
 
   def test_pipeline_runtime_checking_violation_simple_type_output(self):
     self.p._options.view_as(TypeOptions).runtime_type_check = True
@@ -1591,8 +1593,8 @@ class PTransformTypeCheckTestCase(TypeHintTestCase):
          | 'C' >> beam.Create(range(5)).with_output_types(int)
          | 'Mean' >> combine.Mean.Globally())
 
-    self.assertTrue(d.element_type is float)
     assert_that(d, equal_to([2.0]))
+    self.assertEqual(float, d.element_type)
     self.p.run()
 
   def test_mean_globally_pipeline_checking_violated(self):
@@ -1614,8 +1616,8 @@ class PTransformTypeCheckTestCase(TypeHintTestCase):
          | 'C' >> beam.Create(range(5)).with_output_types(int)
          | 'Mean' >> combine.Mean.Globally())
 
-    self.assertTrue(d.element_type is float)
     assert_that(d, equal_to([2.0]))
+    self.assertEqual(float, d.element_type)
     self.p.run()
 
   def test_mean_globally_runtime_checking_violated(self):
@@ -1707,8 +1709,8 @@ class PTransformTypeCheckTestCase(TypeHintTestCase):
          | 'P' >> beam.Create(range(5)).with_output_types(int)
          | 'CountInt' >> combine.Count.Globally())
 
-    self.assertTrue(d.element_type is int)
     assert_that(d, equal_to([5]))
+    self.assertEqual(int, d.element_type)
     self.p.run()
 
   def test_count_globally_runtime_type_checking_satisfied(self):
@@ -1718,8 +1720,8 @@ class PTransformTypeCheckTestCase(TypeHintTestCase):
          | 'P' >> beam.Create(range(5)).with_output_types(int)
          | 'CountInt' >> combine.Count.Globally())
 
-    self.assertTrue(d.element_type is int)
     assert_that(d, equal_to([5]))
+    self.assertEqual(int, d.element_type)
     self.p.run()
 
   def test_count_perkey_pipeline_type_checking_satisfied(self):