Skip to content

Commit 5d0a0b1

Browse files
committed
BUG: assert_frame_equal(check_dtype=False) treats missing sentinels as equal across dtypes (GH#61473)
1 parent 6cca195 commit 5d0a0b1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/util/test_assert_frame_equal.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pandas as pd
66
from pandas import DataFrame
77
import pandas._testing as tm
8+
from pandas.testing import assert_frame_equal
89

910

1011
@pytest.fixture(params=[True, False])
@@ -399,6 +400,7 @@ def test_assert_frame_equal_set_mismatch():
399400
tm.assert_frame_equal(df1, df2)
400401

401402

403+
402404
def test_datetimelike_compat_deprecated():
403405
# GH#55638
404406
df = DataFrame({"a": [1]})
@@ -413,3 +415,11 @@ def test_datetimelike_compat_deprecated():
413415
tm.assert_series_equal(df["a"], df["a"], check_datetimelike_compat=True)
414416
with tm.assert_produces_warning(Pandas4Warning, match=msg):
415417
tm.assert_series_equal(df["a"], df["a"], check_datetimelike_compat=False)
418+
419+
420+
def test_assert_frame_equal_na_object_vs_int32_check_dtype_false():
421+
422+
df1 = pd.DataFrame({"x": pd.Series([pd.NA], dtype="Int32")})
423+
df2 = pd.DataFrame({"x": pd.Series([pd.NA], dtype="object")})
424+
assert_frame_equal(df1, df2, check_dtype=False)
425+

0 commit comments

Comments
 (0)