summaryrefslogtreecommitdiff
path: root/numpy/linalg/tests
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2013-04-13 16:36:46 +0300
committerPauli Virtanen <pav@iki.fi>2013-04-13 16:36:46 +0300
commit8eebee82b88f26f40c75422f5f655dea9f86f4b6 (patch)
treeb9d4a30dca39af53077d01549dd06d47fb62c232 /numpy/linalg/tests
parent374e0b4d2c6f44fdccccfefe0546b607e5291e64 (diff)
downloadnumpy-8eebee82b88f26f40c75422f5f655dea9f86f4b6.tar.gz
TST: linalg: add tests for xerbla functionality (with and without GIL)
Diffstat (limited to 'numpy/linalg/tests')
-rw-r--r--numpy/linalg/tests/test_linalg.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py
index 84c95af10..9e12d7e87 100644
--- a/numpy/linalg/tests/test_linalg.py
+++ b/numpy/linalg/tests/test_linalg.py
@@ -7,7 +7,7 @@ import sys
import numpy as np
from numpy.testing import (TestCase, assert_, assert_equal, assert_raises,
assert_array_equal, assert_almost_equal,
- run_module_suite)
+ run_module_suite, dec)
from numpy import array, single, double, csingle, cdouble, dot, identity
from numpy import multiply, atleast_2d, inf, asarray, matrix
from numpy import linalg
@@ -750,5 +750,23 @@ def test_generalized_raise_multiloop():
assert_raises(np.linalg.LinAlgError, np.linalg.inv, x)
+
+@dec.skipif(sys.platform == "win32", "python_xerbla not enabled on Win32")
+def test_xerbla():
+ # Test that xerbla works (with GIL)
+ a = np.array([[1]])
+ try:
+ np.linalg.lapack_lite.dgetrf(
+ 1, 1, a.astype(np.double),
+ 0, # <- invalid value
+ a.astype(np.intc), 0)
+ except ValueError as e:
+ assert_("DGETRF parameter number 4" in str(e))
+ else:
+ assert_(False)
+
+ # Test that xerbla works (without GIL)
+ assert_raises(ValueError, np.linalg.lapack_lite.xerbla)
+
if __name__ == "__main__":
run_module_suite()