summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYash Mehrotra <yashmehrotra95@gmail.com>2015-10-27 13:55:38 +0530
committerYash Mehrotra <yashmehrotra95@gmail.com>2015-10-27 13:55:38 +0530
commit773437cb73eba2b41ac78dd6e6d9d13f34e65e98 (patch)
treef3e52d4fde8cc0d9b29e63637de38f3f94d4008a
parent69e1fb6a9f97c93648442d99ab383d44c60d9d6d (diff)
downloadnumpy-773437cb73eba2b41ac78dd6e6d9d13f34e65e98.tar.gz
TST: Added tests for empty partition and argpartition
-rw-r--r--numpy/core/tests/test_item_selection.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/numpy/core/tests/test_item_selection.py b/numpy/core/tests/test_item_selection.py
index f3e7701d4..5e9cadd8f 100644
--- a/numpy/core/tests/test_item_selection.py
+++ b/numpy/core/tests/test_item_selection.py
@@ -68,6 +68,24 @@ class TestTake(TestCase):
k = b'\xc3\xa4'.decode("UTF8")
assert_raises(ValueError, d.take, 5, mode=k)
+ def test_empty_partition(self):
+ # In reference to github issue #6530
+ a_original = np.array([0, 2, 4, 6, 8, 10])
+ a = a_original.copy()
+
+ # An empty partition should be a successful no-op
+ a.partition(np.array([], dtype=np.int16))
+
+ assert_array_equal(a, a_original)
+
+ def test_empty_argpartition(self):
+ # In reference to github issue #6530
+ a = np.array([0, 2, 4, 6, 8, 10])
+ a = a.argpartition(np.array([], dtype=np.int16))
+
+ b = np.array([0, 1, 2, 3, 4, 5])
+ assert_array_equal(a, b)
+
if __name__ == "__main__":
run_module_suite()