BUG: testing.assert_series_equal: inferred check_exact should not be passed down to index check #57067
Closed
3 tasks done
Labels
Bug
Needs Triage
Issue that has not been reviewed by a pandas team member
Regression
Functionality that used to work in a prior pandas version
Testing
pandas testing functions or related to the test suite
Milestone
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
In pandas 2.2.0, the above passes if the series' values dtype is float and fails if the series' values dtype is int. In pandas 2.1.4, it passes in both cases.
The difference seems to be caused by a change in the default for the check_exact in
assert_series_equal
:What I think is happening is that, in pandas 2.1.4,
assert_series_equal
was passing down its own defaultcheck_exact=False
toassert_index_equal
- even if the default for the latter ischeck_exact=True
. In 2.2.0,assert_series_equal
inferscheck_exact=True
from the values dtype, and then passes it down toassert_index_equal
.Expected Behavior
In my opinion both pandas 2.2.0 and 2.1.4 are wrong here. If the user doesn't explicitly state
check_exact
, it should default to two potentially different values for the values and the index, which means False for float values, True for int values, and True for the index regardless of dtype (as it already is forassert_index_equal
).Installed Versions
pandas : 2.2.0
numpy : 1.26.3
The text was updated successfully, but these errors were encountered: