10000 Merge pull request #397 from certik/fix2189 · numpy/numpy@7d30cad · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d30cad

Browse files
committed
Merge pull request #397 from certik/fix2189
BUG: Add a test for Ticket #2189
2 parents 9652574 + 0713354 commit 7d30cad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

numpy/core/tests/test_regression.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,5 +1737,15 @@ def test_refcount_error_in_clip(self):
17371737
# Check the final string:
17381738
assert_(y == "[0 0]")
17391739

1740+
def test_searchsorted_wrong_dtype(self):
1741+
# Ticket #2189, it used to segfault, so we check that it raises the
1742+
# proper exception.
1743+
a = np.array([('a', 1)], dtype='S1, int')
1744+
assert_raises(TypeError, np.searchsorted, a, 1.2)
1745+
# Ticket #2066, similar problem:
1746+
dtype = np.format_parser(['i4', 'i4'], [], [])
1747+
a = np.recarray((2, ), dtype)
1748+
assert_raises(TypeError, np.searchsorted, a, 1)
1749+
17401750
if __name__ == "__main__":
17411751
run_module_suite()

0 commit comments

Comments
 (0)
0