diff options
author | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2019-06-02 05:20:54 +0900 |
---|---|---|
committer | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2019-06-02 06:37:13 +0900 |
commit | 2dd6f048fb0985e76018d87ccbce70445dcfa2b7 (patch) | |
tree | d92a07b9d9cd229ee700f8fbc68158f403c5767e /numpy/random/tests | |
parent | 4b4eaa666b18016162c144b7757ba40d8237fdb8 (diff) | |
download | numpy-2dd6f048fb0985e76018d87ccbce70445dcfa2b7.tar.gz |
BUG: Ensure Windows choice returns int32
Downcast from searchsorted on Windows to ensure int32 is returned
closes #9867
Diffstat (limited to 'numpy/random/tests')
-rw-r--r-- | numpy/random/tests/test_randomstate_regression.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/random/tests/test_randomstate_regression.py b/numpy/random/tests/test_randomstate_regression.py index cdd905929..29870534a 100644 --- a/numpy/random/tests/test_randomstate_regression.py +++ b/numpy/random/tests/test_randomstate_regression.py @@ -170,3 +170,14 @@ class TestRegression(object): rs1 = np.random.RandomState(123456789) rs2 = np.random.RandomState(seed=123456789) assert rs1.randint(0, 100) == rs2.randint(0, 100) + + def test_choice_retun_dtype(self): + # GH 9867 + c = np.random.choice(10, p=[.1]*10, size=2) + assert c.dtype == np.dtype(int) + c = np.random.choice(10, p=[.1]*10, replace=False, size=2) + assert c.dtype == np.dtype(int) + c = np.random.choice(10, size=2) + assert c.dtype == np.dtype(int) + c = np.random.choice(10, replace=False, size=2) + assert c.dtype == np.dtype(int) |