diff options
author | gfyoung <gfyoung@mit.edu> | 2016-02-07 00:21:20 +0000 |
---|---|---|
committer | gfyoung <gfyoung@mit.edu> | 2016-02-16 20:01:30 +0000 |
commit | de44e0fb8cf67594227e9770dc8e6f94285cd486 (patch) | |
tree | fc21b5397d74d9446ecf7f4dfca86e3f2086596a /numpy/random/tests/test_random.py | |
parent | f4cc58c80df5202a743bddd514a3485d5e4ec5a4 (diff) | |
download | numpy-de44e0fb8cf67594227e9770dc8e6f94285cd486.tar.gz |
BUG: Enforce dtype for randint singletons
Closes gh-7203.
Diffstat (limited to 'numpy/random/tests/test_random.py')
-rw-r--r-- | numpy/random/tests/test_random.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index 199509361..fac287b3f 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -208,6 +208,15 @@ class TestRandint(TestCase): res = hashlib.md5(val).hexdigest() assert_(tgt[np.dtype(np.bool).name] == res) + def test_respect_dtype_singleton(self): + # See gh-7203 + for dt in self.itype: + lbnd = 0 if dt is np.bool else np.iinfo(dt).min + ubnd = 2 if dt is np.bool else np.iinfo(dt).max + 1 + + sample = self.rfunc(lbnd, ubnd, dtype=dt) + self.assertEqual(sample.dtype, np.dtype(dt)) + class TestRandomDist(TestCase): # Make sure the random distribution returns the correct value for a |