@@ -796,6 +796,24 @@ def assert_extension_array_equal(
796
796
left_na , right_na , obj = f"{ obj } NA mask" , index_values = index_values
797
797
)
798
798
799
+ # Specifically for StringArrayNumpySemantics, validate here we have a valid array
800
+ if (
801
+ isinstance (left .dtype , StringDtype )
802
+ and left .dtype .storage == "python"
803
+ and left .dtype .na_value is np .nan
804
+ ):
805
+ assert np .all (
806
+ [np .isnan (val ) for val in left ._ndarray [left_na ]] # type: ignore[attr-defined]
807
+ ), "wrong missing value sentinels"
808
+ if (
809
+ isinstance (right .dtype , StringDtype )
810
+ and right .dtype .storage == "python"
811
+ and right .dtype .na_value is np .nan
812
+ ):
813
+ assert np .all (
814
+ [np .isnan (val ) for val in right ._ndarray [right_na ]] # type: ignore[attr-defined]
815
+ ), "wrong missing value sentinels"
816
+
799
817
left_valid = left [~ left_na ].to_numpy (dtype = object )
800
818
right_valid = right [~ right_na ].to_numpy (dtype = object )
801
819
if check_exact :
@@ -1158,7 +1176,10 @@ def assert_frame_equal(
1158
1176
Specify how to compare internal data. If False, compare by columns.
1159
1177
If True, compare by blocks.
1160
1178
check_exact : bool, default False
1161
- Whether to compare number exactly.
1179
+ Whether to compare number exactly. If False, the comparison uses the
1180
+ relative tolerance (``rtol``) and absolute tolerance (``atol``)
1181
+ parameters to determine if two values are considered close,
1182
+ according to the formula: ``|a - b| <= (atol + rtol * |b|)``.
1162
1183
1163
1184
.. versionchanged:: 2.2.0
1164
1185
0 commit comments