@@ -276,19 +276,6 @@ def test_numpy_array_equal_message(self):
276
276
assert_almost_equal (np .array ([[1 , 2 ], [3 , 4 ]]),
277
277
np .array ([[1 , 3 ], [3 , 4 ]]))
278
278
279
- expected = """numpy array are different
280
-
281
- numpy array values are different \\ (33\\ .33333 %\\ )
282
- \\ [left\\ ]: \\ [á, à, ä\\ ]
283
- \\ [right\\ ]: \\ [á, à, å\\ ]"""
284
-
285
- with tm .assert_raises_regex (AssertionError , expected ):
286
- assert_numpy_array_equal (np .array ([u'á' , u'à' , u'ä' ]),
287
- np .array ([u'á' , u'à' , u'å' ]))
288
- with tm .assert_raises_regex (AssertionError , expected ):
289
- assert_almost_equal (np .array ([u'á' , u'à' , u'ä' ]),
290
- np .array ([u'á' , u'à' , u'å' ]))
291
-
292
279
# allow to overwrite message
293
280
expected = """Index are different
294
281
@@ -303,6 +290,24 @@ def test_numpy_array_equal_message(self):
303
290
assert_almost_equal (np .array ([1 , 2 ]), np .array ([3 , 4 , 5 ]),
304
291
obj = 'Index' )
305
292
293
+ def test_numpy_array_equal_unicode_message (self ):
294
+ # Test ensures that `assert_numpy_array_equals` raises the right
295
+ # exception when comparing np.arrays containing differing
296
+ # unicode objects (#20503)
297
+
298
+ expected = """numpy array are different
299
+
300
+ numpy array values are different \\ (33\\ .33333 %\\ )
301
+ \\ [left\\ ]: \\ [á, à, ä\\ ]
302
+ \\ [right\\ ]: \\ [á, à, å\\ ]"""
303
+
304
+ with tm .assert_raises_regex (AssertionError , expected ):
305
+ assert_numpy_array_equal (np .array ([u'á' , u'à' , u'ä' ]),
306
+ np .array ([u'á' , u'à' , u'å' ]))
307
+ with tm .assert_raises_regex (AssertionError , expected ):
308
+ assert_almost_equal (np .array ([u'á' , u'à' , u'ä' ]),
309
+ np .array ([u'á' , u'à' , u'å' ]))
310
+
306
311
@td .skip_if_windows
307
312
def test_numpy_array_equal_object_message (self ):
308
313
@@ -693,6 +698,11 @@ def test_frame_equal_message(self):
693
698
pd .DataFrame ({'A' : [1 , 2 , 3 ], 'B' : [4 , 5 , 7 ]}),
694
699
by_blocks = True )
695
700
701
+ def test_frame_equal_message_unicode (self ):
702
+ # Test ensures that `assert_frame_equals` raises the right
703
+ # exception when comparing DataFrames containing differing
704
+ # unicode objects (#20503)
705
+
696
706
expected = """DataFrame\\ .iloc\\ [:, 1\\ ] are different
697
707
698
708
DataFrame\\ .iloc\\ [:, 1\\ ] values are different \\ (33\\ .33333 %\\ )
0 commit comments