beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rober...@apache.org
Subject [2/3] incubator-beam git commit: Adding unit tests
Date Thu, 03 Nov 2016 21:36:14 GMT
Adding unit tests


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

Branch: refs/heads/python-sdk
Commit: b30208bea7506d585a59b3c4c7dd346afd714287
Parents: 3321064
Author: Pablo <pabloem@google.com>
Authored: Thu Nov 3 11:57:27 2016 -0700
Committer: Robert Bradshaw <robertwb@google.com>
Committed: Thu Nov 3 14:30:50 2016 -0700

----------------------------------------------------------------------
 .../apache_beam/internal/json_value_test.py       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/b30208be/sdks/python/apache_beam/internal/json_value_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/json_value_test.py b/sdks/python/apache_beam/internal/json_value_test.py
index b3d9e83..cfab293 100644
--- a/sdks/python/apache_beam/internal/json_value_test.py
+++ b/sdks/python/apache_beam/internal/json_value_test.py
@@ -67,6 +67,24 @@ class JsonValueTest(unittest.TestCase):
   def test_none_from(self):
     self.assertIsNone(from_json_value(to_json_value(None)))
 
+  def test_large_integer(self):
+    num = 1 << 35
+    self.assertEquals(num, from_json_value(to_json_value(num)))
+    self.assertEquals(long(num), from_json_value(to_json_value(long(num))))
+
+  def test_long_value(self):
+    self.assertEquals(long(27), from_json_value(to_json_value(long(27))))
+
+  def test_too_long_value(self):
+    try:
+      to_json_value(long(1 << 64))
+    except TypeError as e:
+      pass
+    except Exception as e:
+      self.fail('Unexpected exception raised: {}'.format(e))
+    else:
+      self.fail('TypeError not raised.')
+
 
 if __name__ == '__main__':
   unittest.main()


Mime
View raw message