[Numpy-svn] r4784 - trunk/numpy/core/tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Feb 10 01:19:44 EST 2008
Author: charris
Date: 2008-02-10 00:19:42 -0600 (Sun, 10 Feb 2008)
New Revision: 4784
Modified:
trunk/numpy/core/tests/test_regression.py
Log:
Add tests for sorting strings containing zeros.
Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py 2008-02-10 05:11:58 UTC (rev 4783)
+++ trunk/numpy/core/tests/test_regression.py 2008-02-10 06:19:42 UTC (rev 4784)
@@ -780,5 +780,17 @@
y = np.array(['d','e'])
assert_equal(x.searchsorted(y), [3,3])
+ def check_string_argsort_with_zeros(self, level=rlevel):
+ """Check argsort for strings containing zeros."""
+ x = np.fromstring("\x00\x02\x00\x01", dtype="|S2")
+ assert_array_equal(x.argsort(kind='m'), np.array([1,0]))
+ assert_array_equal(x.argsort(kind='q'), np.array([1,0]))
+
+ def check_string_sort_with_zeros(self, level=rlevel):
+ """Check sort for strings containing zeros."""
+ x = np.fromstring("\x00\x02\x00\x01", dtype="|S2")
+ y = np.fromstring("\x00\x01\x00\x02", dtype="|S2")
+ assert_array_equal(np.sort(x, kind="q"), y)
+
if __name__ == "__main__":
NumpyTest().run()
More information about the Numpy-svn
mailing list