diff options
author | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2019-04-12 17:06:30 +0100 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2019-05-20 18:45:27 +0300 |
commit | f11921d6f2578a1cc74dc15bd1458c62d180c01f (patch) | |
tree | a678b8de077082b5f141d0adf090ccba64595e3e /numpy/random/tests | |
parent | bb7abf2d5bff82a48dbd773c31f66164abdd849d (diff) | |
download | numpy-f11921d6f2578a1cc74dc15bd1458c62d180c01f.tar.gz |
MAINT: Simplify return types
Standardize returns types for Windows and 32-bit platforms on int64
in choice and randint (default).
Refactor tomaxint to call randint
Diffstat (limited to 'numpy/random/tests')
-rw-r--r-- | numpy/random/tests/test_against_numpy.py | 1 | ||||
-rw-r--r-- | numpy/random/tests/test_generator_mt19937.py | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/numpy/random/tests/test_against_numpy.py b/numpy/random/tests/test_against_numpy.py index b930fcbff..9846ba38f 100644 --- a/numpy/random/tests/test_against_numpy.py +++ b/numpy/random/tests/test_against_numpy.py @@ -183,6 +183,7 @@ class TestAgainstNumPy(object): self.rs.standard_exponential) self._is_state_common_legacy() + @pytest.mark.xfail(reason='Stream broken for simplicity') def test_tomaxint(self): self._set_common_state() self._is_state_common() diff --git a/numpy/random/tests/test_generator_mt19937.py b/numpy/random/tests/test_generator_mt19937.py index 895e7fc6c..d76291d1a 100644 --- a/numpy/random/tests/test_generator_mt19937.py +++ b/numpy/random/tests/test_generator_mt19937.py @@ -639,6 +639,18 @@ class TestRandomDist(object): p = [None, None, None] assert_raises(ValueError, random.choice, a, p=p) + def test_choice_return_type(self): + # gh 9867 + p = np.ones(4) / 4. + actual = random.choice(4, 2) + assert actual.dtype == np.int64 + actual = random.choice(4, 2, replace=False) + assert actual.dtype == np.int64 + actual = random.choice(4, 2, p=p) + assert actual.dtype == np.int64 + actual = random.choice(4, 2, p=p, replace=False) + assert actual.dtype == np.int64 + def test_bytes(self): random.brng.seed(self.seed) actual = random.bytes(10) |