diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2006-09-18 23:27:24 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2006-09-18 23:27:24 +0000 |
commit | 371f8c6a1df8b2d244afd50d03e492d79a1372fe (patch) | |
tree | 2d6d3cd8e59ea5da96e5bb710cf890a11696b293 /numpy/lib/tests/test_arraysetops.py | |
parent | 29cb5ffae98ad43a3e7ebada8dc77ce0a4045529 (diff) | |
download | numpy-371f8c6a1df8b2d244afd50d03e492d79a1372fe.tar.gz |
Add ediff1d support for empty arrays.
Fix ediff1d for to_begin or to_end = 0.
Allow insert to operate on empty arrays.
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r-- | numpy/lib/tests/test_arraysetops.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index 706564410..ae98884d6 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -6,6 +6,7 @@ from numpy.testing import * set_package_path() import numpy from numpy.lib.arraysetops import * +from numpy.lib.arraysetops import ediff1d restore_path() ################################################## @@ -68,6 +69,17 @@ class test_aso(NumpyTestCase): c = setxor1d( a, b ) assert_array_equal( c, ec ) + def check_ediff1d(self): + zero_elem = numpy.array([]) + one_elem = numpy.array([1]) + two_elem = numpy.array([1,2]) + + assert_array_equal([],ediff1d(zero_elem)) + assert_array_equal([0],ediff1d(zero_elem,to_begin=0)) + assert_array_equal([0],ediff1d(zero_elem,to_end=0)) + assert_array_equal([-1,0],ediff1d(zero_elem,to_begin=-1,to_end=0)) + assert_array_equal([],ediff1d(one_elem)) + assert_array_equal([1],ediff1d(two_elem)) ## # 03.11.2005, c |