diff options
author | Konrad Kapp <k_kapp@yahoo.com> | 2017-05-20 12:50:15 +0200 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-05-20 11:50:15 +0100 |
commit | e52efca5accf06016ca4c1b180216e66db881ce2 (patch) | |
tree | d2c73c5a287933242ea531545d35dc885ea6e892 /numpy/lib/tests/test_arraysetops.py | |
parent | d090484f8ec0daae720e79169e1a853f84e6deb4 (diff) | |
download | numpy-e52efca5accf06016ca4c1b180216e66db881ce2.tar.gz |
BUG: set default type for empty index array to `numpy.intp` (#9142)
Fixes #9137
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r-- | numpy/lib/tests/test_arraysetops.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index fa664ff24..d47534f82 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -355,6 +355,16 @@ class TestUnique(TestCase): a2, a2_inv = np.unique(a, return_inverse=True) assert_array_equal(a2_inv, np.zeros(5)) + # test for ticket #9137 + a = [] + a1_idx = np.unique(a, return_index=True)[1] + a2_inv = np.unique(a, return_inverse=True)[1] + a3_idx, a3_inv = np.unique(a, return_index=True, return_inverse=True)[1:] + assert_equal(a1_idx.dtype, np.intp) + assert_equal(a2_inv.dtype, np.intp) + assert_equal(a3_idx.dtype, np.intp) + assert_equal(a3_inv.dtype, np.intp) + def test_unique_axis_errors(self): assert_raises(TypeError, self._run_axis_tests, object) assert_raises(TypeError, self._run_axis_tests, |