Skip to content

Commit 9d93fea

Browse files
committed
TST: test "check_same" in assert_numpy_array_equal()
1 parent bea8101 commit 9d93fea

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/test_testing.py

+11
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,17 @@ def test_numpy_array_equal_object_message(self):
315315
with assertRaisesRegexp(AssertionError, expected):
316316
assert_almost_equal(a, b)
317317

318+
def test_numpy_array_equal_copy_flag(self):
319+
a = np.array([1, 2, 3])
320+
b = a.copy()
321+
c = a.view()
322+
expected = 'array\(\[1, 2, 3\]\) is not array\(\[1, 2, 3\]\)'
323+
with assertRaisesRegexp(AssertionError, expected):
324+
assert_numpy_array_equal(a, b, check_same='same')
325+
expected = 'array\(\[1, 2, 3\]\) is array\(\[1, 2, 3\]\)'
326+
with assertRaisesRegexp(AssertionError, expected):
327+
assert_numpy_array_equal(a, c, check_same='copy')
328+
318329
def test_assert_almost_equal_iterable_message(self):
319330

320331
expected = """Iterable are different

0 commit comments

Comments
 (0)