@@ -413,3 +413,34 @@ def test_datetimelike_compat_deprecated():
413413 tm .assert_series_equal (df ["a" ], df ["a" ], check_datetimelike_compat = True )
414414 with tm .assert_produces_warning (Pandas4Warning , match = msg ):
415415 tm .assert_series_equal (df ["a" ], df ["a" ], check_datetimelike_compat = False )
416+
417+
418+ def test_assert_frame_equal_na_object_vs_int32_check_dtype_false ():
419+ #GH# 61473
420+ df1 = pd .DataFrame ({"a" : pd .Series ([pd .NA ], dtype = "Int32" )})
421+ df2 = pd .DataFrame ({"a" : pd .Series ([pd .NA ], dtype = "object" )})
422+ tm .assert_frame_equal (df1 , df2 , check_dtype = False )
423+
424+
425+ def test_assert_frame_equal_object_vs_int32_check_dtype_false ():
426+ #GH# 61473
427+ df1 = pd .DataFrame ({"a" : pd .Series ([pd .NA ,0 ], dtype = "Int32" )})
428+ df2 = pd .DataFrame ({"a" : pd .Series ([pd .NA ,0 ], dtype = "object" )})
429+ tm .assert_frame_equal (df1 , df2 , check_dtype = False )
430+
431+
432+ def test_assert_frame_not_equal_object_vs_int32_check_dtype_false ():
433+ #GH# 61473
434+ df1 = pd .DataFrame ({"a" : pd .Series ([pd .NA ,0 ], dtype = "Int32" )})
435+ df2 = pd .DataFrame ({"a" : pd .Series ([pd .NA ,1 ], dtype = "object" )})
436+ msg = (
437+ r"""DataFrame\.iloc\[:, 0\] \(column name="a"\) are different
438+
439+ DataFrame\.iloc\[:, 0\] \(column name="a"\) values are different \(50\.0 %\)
440+ \[index\]: \[0, 1\]
441+ \[left\]: \[<NA>, 0\]
442+ \[right\]: \[<NA>, 1\]"""
443+ )
444+ with pytest .raises (AssertionError , match = msg ):
445+ tm .assert_frame_equal (df1 , df2 , check_dtype = False )
446+
0 commit comments