Skip to content

TST: assert reading of legacy pickles against current data #61792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche commented Jul 7, 2025

While reviewing #61770, I noticed that we didn't actually compare the read pickle data to some ground truth expected value, but just to itself (we were essentially doing assert_equal(result, result) ..), due to some accidental change in a clean-up many years ago in f2246cf)

Fixing that here by again creating the expected unpickled data with create_pickle_data() during the test run, to compare with the data from the older pickled files.

@jorisvandenbossche jorisvandenbossche added Testing pandas testing functions or related to the test suite IO Pickle read_pickle, to_pickle labels Jul 7, 2025
Comment on lines +222 to +229
# "cat_onecol": DataFrame({"A": Categorical(["foo", "bar"])}),
"cat_onecol": DataFrame(
{
"A": Categorical.from_codes(
[1, 0], categories=Index(["bar", "foo"], dtype="object")
)
}
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorisvandenbossche to get the old behavior here, the code changes are a bit more involved. I've not got round to reviewing all the migration guides/release notes yet. Is this included? if not, should it be?

and legacy_version < Version("1.3.0")
):
# convert to wall time
# (bug since pandas 2.0 that tz gets dropped for older pickle files)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an issue ref for this

@mroeschke mroeschke added this to the 3.0 milestone Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Pickle read_pickle, to_pickle Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants