summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorBlake Griffith <blake.a.griffith@gmail.com>2015-03-26 15:20:47 -0500
committerBlake Griffith <blake.a.griffith@gmail.com>2015-03-26 15:20:47 -0500
commit9713a276df05f16aa9b8b47f6a9418db1133a4ec (patch)
tree683b128558481a2963f4d2aa1f613c213c8c18a2 /numpy
parenta4cd4744c08f84c624c34ff8bd1aff248ede64a8 (diff)
downloadnumpy-9713a276df05f16aa9b8b47f6a9418db1133a4ec.tar.gz
TST: Regression test for gh-5719
Previously this would cause a segfault, now we check that this case raises an OverflowError.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_dtype.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py
index 2621c8696..3a255b038 100644
--- a/numpy/core/tests/test_dtype.py
+++ b/numpy/core/tests/test_dtype.py
@@ -3,6 +3,7 @@ from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.testing import *
+from numpy.core.test_rational import rational
def assert_dtype_equal(a, b):
assert_equal(a, b)
@@ -533,5 +534,11 @@ class TestDtypeAttributes(TestCase):
assert_equal(np.dtype(user_def_subcls).name, 'user_def_subcls')
+def test_rational_dtype():
+ # test for bug gh-5719
+ a = np.array([1111], dtype=rational).astype
+ assert_raises(OverflowError, a, 'int8')
+
+
if __name__ == "__main__":
run_module_suite()