summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_arraysetops.py
diff options
context:
space:
mode:
authorJason Thai <jasonnthaii@gmail.com>2022-05-28 00:36:43 -0700
committerJason Thai <jasonnthaii@gmail.com>2022-05-28 00:44:53 -0700
commit172a27fae4829933c4a8a7393aa6d0e71f9cc609 (patch)
treece3c98b2eaa2b19141edf015cc3ca13fc39a9bb8 /numpy/lib/tests/test_arraysetops.py
parentc59b0a97229bbe2bc3e50a8bbc0cbea05df72b8f (diff)
downloadnumpy-172a27fae4829933c4a8a7393aa6d0e71f9cc609.tar.gz
TST: Added test for np.unique equal_nans kwarg
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r--numpy/lib/tests/test_arraysetops.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py
index 13385cd24..f97fea310 100644
--- a/numpy/lib/tests/test_arraysetops.py
+++ b/numpy/lib/tests/test_arraysetops.py
@@ -765,3 +765,11 @@ class TestUnique:
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)
+
+ def test_unique_nanequals(self):
+ # issue 20326
+ a = np.array([1, 1, np.nan, np.nan, np.nan])
+ unq = np.unique(a)
+ not_unq = np.unique(a, equal_nans = False)
+ assert_array_equal(unq, np.array([1, np.nan]))
+ assert_array_equal(not_unq, np.array([1, np.nan, np.nan, np.nan]))