summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_arraysetops.py
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2022-06-01 20:03:15 +0300
committerGitHub <noreply@github.com>2022-06-01 20:03:15 +0300
commit6cada27f1744d004a6d8ca7731c9a6d5dfed9b3a (patch)
treeb11873b378b3d89584b6fb57cd534f040eacbd80 /numpy/lib/tests/test_arraysetops.py
parent66070156f2006a5a1a551573d9df189e2675b456 (diff)
parent7a880a65a2b519995e2a1a4c911380170d38ae1b (diff)
downloadnumpy-6cada27f1744d004a6d8ca7731c9a6d5dfed9b3a.tar.gz
Merge pull request #21623 from rjeb/unique-equalnans
ENH: Add equals_nans kwarg to np.unique Fixes #20326
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]))