summaryrefslogtreecommitdiff
path: root/scipy/weave/tests/test_inline_tools.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2005-09-26 20:20:16 +0000
committerTravis Oliphant <oliphant@enthought.com>2005-09-26 20:20:16 +0000
commit45d01a4be1c4221132ba46d687e6af3a8df3329b (patch)
treece3be5290e918def7c7187e747c5460193b0ca85 /scipy/weave/tests/test_inline_tools.py
parentccd1c3db37672627aa4fe0fdb5437f5dddc0fe86 (diff)
downloadnumpy-45d01a4be1c4221132ba46d687e6af3a8df3329b.tar.gz
Moved weave
Diffstat (limited to 'scipy/weave/tests/test_inline_tools.py')
-rw-r--r--scipy/weave/tests/test_inline_tools.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/scipy/weave/tests/test_inline_tools.py b/scipy/weave/tests/test_inline_tools.py
new file mode 100644
index 000000000..2d197cd19
--- /dev/null
+++ b/scipy/weave/tests/test_inline_tools.py
@@ -0,0 +1,46 @@
+import unittest
+from scipy_base.numerix import *
+
+from scipy_test.testing import *
+set_package_path()
+from weave import inline_tools
+restore_path()
+set_local_path()
+from test_scxx import *
+restore_path()
+
+class test_inline(unittest.TestCase):
+ """ These are long running tests...
+
+ I'd like to benchmark these things somehow.
+ """
+ def check_exceptions(self,level=5):
+ a = 3
+ code = """
+ if (a < 2)
+ throw_error(PyExc_ValueError,
+ "the variable 'a' should not be less than 2");
+ else
+ return_val = PyInt_FromLong(a+1);
+ """
+ result = inline_tools.inline(code,['a'])
+ assert(result == 4)
+
+ try:
+ a = 1
+ result = inline_tools.inline(code,['a'])
+ assert(1) # should've thrown a ValueError
+ except ValueError:
+ pass
+
+ from distutils.errors import DistutilsError, CompileError
+ try:
+ a = 'string'
+ result = inline_tools.inline(code,['a'])
+ assert(1) # should've gotten an error
+ except:
+ # ?CompileError is the error reported, but catching it doesn't work
+ pass
+
+if __name__ == "__main__":
+ ScipyTest('weave.inline_tools').run()