Skip to content

BUG: assert_series_equal raising about class difference when check_exact=True #56132

Open
@MarcoGorelli

Description

@MarcoGorelli

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

from numpy import ma

data = ma.masked_all(3,)
data[0] = 0
data[2] = 2
data[1] = 1

left = pd.Series(data)
right = pd.Series([0, 1, 2], dtype=float)
pd.testing.assert_series_equal(left, right)  # passes
pd.testing.assert_series_equal(left, right, check_dtype=True)  # passes
pd.testing.assert_series_equal(left, right, check_dtype=True, check_exact=True)  # raises!

Issue Description

This is odd - check_exact is supposed to only affect whether the numbers are to be compared exactly, it's not supposed to say anything about whether the classes are to be checked

Expected Behavior

Not really sure yet

Installed Versions

INSTALLED VERSIONS

commit : 1c606d5
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.102.1-microsoft-standard-WSL2
Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 2.2.0.dev0+694.g1c606d5f01
numpy : 1.25.1
pytz : 2023.3
dateutil : 2.8.2
setuptools : 67.6.1
pip : 23.1.2
Cython : None
pytest : 7.3.1
hypothesis : 6.82.4
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.16.1
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.2
bottleneck : None
dataframe-api-compat : None
fastparquet : 2023.7.0
fsspec : 2023.6.0
gcsfs : None
matplotlib : 3.7.1
numba : 0.58.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 12.0.1
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.11.0
sqlalchemy : 2.0.20
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

Labels

BugTestingpandas testing functions or related to the test suite

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions