summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_arraysetops.py
diff options
context:
space:
mode:
authorCJ Carey <perimosocordiae@gmail.com>2014-09-22 14:30:36 -0400
committerCJ Carey <perimosocordiae@gmail.com>2014-09-23 11:06:53 -0400
commit7efd5cf4cc6cd45f6114fdbc3fbfd619ddf03deb (patch)
tree69b5a584a51d5919526485784d14b5dc6d68266c /numpy/lib/tests/test_arraysetops.py
parentc85e31e6331efe96034fe76c5a6b9d60698c0f23 (diff)
downloadnumpy-7efd5cf4cc6cd45f6114fdbc3fbfd619ddf03deb.tar.gz
BUG: np.unique with chararray + inverse_index
The call to `empty_like` was trying to use the `chararray` subclass, which doesn't support the `np.intp` dtype.
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r--numpy/lib/tests/test_arraysetops.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py
index e83f8552e..39196f4bc 100644
--- a/numpy/lib/tests/test_arraysetops.py
+++ b/numpy/lib/tests/test_arraysetops.py
@@ -109,6 +109,12 @@ class TestSetOps(TestCase):
assert_array_equal(a2, unq)
assert_array_equal(a2_inv, inv)
+ # test for chararrays with return_inverse (gh-5099)
+ a = np.chararray(5)
+ a[...] = ''
+ a2, a2_inv = np.unique(a, return_inverse=True)
+ assert_array_equal(a2_inv, np.zeros(5))
+
def test_intersect1d(self):
# unique inputs
a = np.array([5, 7, 1, 2])