summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej.certik@gmail.com>2012-09-02 09:35:43 -0700
committerOndřej Čertík <ondrej.certik@gmail.com>2012-09-02 09:35:43 -0700
commit7d30cada0e3ec6119c30212238c4d8d7fe678dc5 (patch)
tree8ff3c9fb556dbbf3d312ee2eac2b69559862c8d3 /numpy
parent96525749fbecc6695f0dfbf2a7b00ec0105a1078 (diff)
parent0713354fa282f096e30886e7617d84ee2938390d (diff)
downloadnumpy-7d30cada0e3ec6119c30212238c4d8d7fe678dc5.tar.gz
Merge pull request #397 from certik/fix2189
BUG: Add a test for Ticket #2189
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_regression.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 08431c6f0..53471b2c2 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -1737,5 +1737,15 @@ class TestRegression(TestCase):
# Check the final string:
assert_(y == "[0 0]")
+ def test_searchsorted_wrong_dtype(self):
+ # Ticket #2189, it used to segfault, so we check that it raises the
+ # proper exception.
+ a = np.array([('a', 1)], dtype='S1, int')
+ assert_raises(TypeError, np.searchsorted, a, 1.2)
+ # Ticket #2066, similar problem:
+ dtype = np.format_parser(['i4', 'i4'], [], [])
+ a = np.recarray((2, ), dtype)
+ assert_raises(TypeError, np.searchsorted, a, 1)
+
if __name__ == "__main__":
run_module_suite()