diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-04-22 14:09:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-22 14:09:43 -0700 |
commit | 80de28de294b24f926133a86176f64f6a13c5411 (patch) | |
tree | 33aaa221ac82a571243adb56a60359240bb52507 /numpy/lib/tests/test_arraysetops.py | |
parent | 14e64281cfe374a9cad476599cbe9b4fa850efb7 (diff) | |
parent | b5c1bcf1e8ef6e9c11bb4138a15286e648fcbce0 (diff) | |
download | numpy-80de28de294b24f926133a86176f64f6a13c5411.tar.gz |
Merge branch 'master' into npzfile-mappin
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r-- | numpy/lib/tests/test_arraysetops.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index 17415d8fe..76c36c53e 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -4,9 +4,9 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import ( - run_module_suite, assert_array_equal, assert_equal, assert_raises, - ) +import sys + +from numpy.testing import assert_array_equal, assert_equal, assert_raises from numpy.lib.arraysetops import ( ediff1d, intersect1d, setxor1d, union1d, setdiff1d, unique, in1d, isin ) @@ -453,6 +453,15 @@ class TestUnique(object): assert_array_equal(v.data, v2.data, msg) assert_array_equal(v.mask, v2.mask, msg) + def test_unique_sort_order_with_axis(self): + # These tests fail if sorting along axis is done by treating subarrays + # as unsigned byte strings. See gh-10495. + fmt = "sort order incorrect for integer type '%s'" + for dt in 'bhilq': + a = np.array([[-1],[0]], dt) + b = np.unique(a, axis=0) + assert_array_equal(a, b, fmt % dt) + def _run_axis_tests(self, dtype): data = np.array([[0, 1, 0, 0], [1, 0, 0, 0], @@ -493,7 +502,3 @@ class TestUnique(object): assert_array_equal(uniq[:, inv], data) msg = "Unique's return_counts=True failed with axis=1" assert_array_equal(cnt, np.array([2, 1, 1]), msg) - - -if __name__ == "__main__": - run_module_suite() |