You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2016/02/25 00:56:34 UTC

[33/36] lucy-clownfish git commit: Test err handling in Py glue.

Test err handling in Py glue.

Check that a Clownfish exception gets transformed into a Python
exception.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/674721cc
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/674721cc
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/674721cc

Branch: refs/heads/py_exp13
Commit: 674721cc3e0f7fac030cf75fcdcfc4ee3d2f539f
Parents: b05965c
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Feb 22 18:29:02 2016 -0800
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Wed Feb 24 15:36:08 2016 -0800

----------------------------------------------------------------------
 runtime/python/test/test_err.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/674721cc/runtime/python/test/test_err.py
----------------------------------------------------------------------
diff --git a/runtime/python/test/test_err.py b/runtime/python/test/test_err.py
new file mode 100644
index 0000000..a553d74
--- /dev/null
+++ b/runtime/python/test/test_err.py
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import unittest
+import clownfish
+import sys
+
+class TestErr(unittest.TestCase):
+
+    def testErrorHandling(self):
+        vec = clownfish.Vector()
+        try:
+            vec.grow(sys.maxsize)
+        except RuntimeError as e:
+            self.assertTrue(str(e).find("overflow") != -1)
+
+if __name__ == '__main__':
+    unittest.main()
+