Skip to content

Commit 950e0bf

Browse files
Daniel SaxtonDaniel Saxton
Daniel Saxton
authored and
Daniel Saxton
committed
Add test
1 parent 415e43b commit 950e0bf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/tests/util/test_assert_numpy_array_equal.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
from pandas._libs.missing import NA
5+
46
from pandas import Timestamp
57
import pandas._testing as tm
68

@@ -175,3 +177,18 @@ def test_numpy_array_equal_copy_flag(other_type, check_same):
175177
tm.assert_numpy_array_equal(a, other, check_same=check_same)
176178
else:
177179
tm.assert_numpy_array_equal(a, other, check_same=check_same)
180+
181+
182+
def test_numpy_array_equal_contains_na():
183+
# https://github.com/pandas-dev/pandas/issues/31881
184+
a = np.array([True, False])
185+
b = np.array([True, NA])
186+
187+
msg = """numpy array are different
188+
189+
numpy array values are different \\(50.0 %\\)
190+
\\[left\\]: \\[True, False\\]
191+
\\[right\\]: \\[True, <NA>\\]"""
192+
193+
with pytest.raises(AssertionError, match=msg):
194+
tm.assert_numpy_array_equal(a, b)

0 commit comments

Comments
 (0)