summaryrefslogtreecommitdiff
path: root/numpy/random/tests
diff options
context:
space:
mode:
authorKevin Sheppard <kevin.k.sheppard@gmail.com>2017-10-09 14:57:38 +0100
committerKevin Sheppard <kevin.k.sheppard@gmail.com>2017-10-18 11:43:47 +0100
commitad8a4c72321dcdde4ead76a0dc2b67071e75326a (patch)
tree71a6586a899aa7f170a264d42f7f797a42d17d19 /numpy/random/tests
parent77f9540f277de3e727d696eb5987a0505ed8cdf9 (diff)
downloadnumpy-ad8a4c72321dcdde4ead76a0dc2b67071e75326a.tar.gz
BUG: Prevent invalid array shapes in seed
Prevent empty arrays or arrays with more than 1 dimension from being used to seed RandomState closes #9832
Diffstat (limited to 'numpy/random/tests')
-rw-r--r--numpy/random/tests/test_random.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py
index e9c9bc492..6ada4d997 100644
--- a/numpy/random/tests/test_random.py
+++ b/numpy/random/tests/test_random.py
@@ -42,6 +42,13 @@ class TestSeed(object):
assert_raises(ValueError, np.random.RandomState, [1, 2, 4294967296])
assert_raises(ValueError, np.random.RandomState, [1, -2, 4294967296])
+ def test_invalid_array_shape(self):
+ # gh-9832
+ assert_raises(ValueError, np.random.RandomState, np.array([], dtype=np.int64))
+ assert_raises(ValueError, np.random.RandomState, [[1, 2, 3]])
+ assert_raises(ValueError, np.random.RandomState, [[1, 2, 3],
+ [4, 5, 6]])
+
class TestBinomial(object):
def test_n_zero(self):