Skip to content

Commit 260cddd

Browse files
committed
TST: assert_allclose behavior with nans that are also infs
1 parent ada0864 commit 260cddd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

numpy/testing/tests/test_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,11 +1295,21 @@ def test_equal_nan(self):
12951295
# Should not raise:
12961296
assert_allclose(a, b, equal_nan=True)
12971297

1298+
a = np.array([complex(np.nan, np.inf)])
1299+
b = np.array([complex(np.nan, np.inf)])
1300+
assert_allclose(a, b, equal_nan=True)
1301+
b = np.array([complex(np.nan, -np.inf)])
1302+
assert_allclose(a, b, equal_nan=True)
1303+
12981304
def test_not_equal_nan(self):
12991305
a = np.array([np.nan])
13001306
b = np.array([np.nan])
13011307
assert_raises(AssertionError, assert_allclose, a, b, equal_nan=False)
13021308

1309+
a = np.array([complex(np.nan, np.inf)])
1310+
b = np.array([complex(np.nan, np.inf)])
1311+
assert_raises(AssertionError, assert_allclose, a, b, equal_nan=False)
1312+
13031313
def test_equal_nan_default(self):
13041314
# Make sure equal_nan default behavior remains unchanged. (All
13051315
# of these functions use assert_array_compare under the hood.)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy