Skip to content
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

test(python): Use assert_frame_equal instead of assert df.frame_equal(...) #6553

Merged
merged 11 commits into from
Jan 30, 2023

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jan 29, 2023

Relates to #6364

assert_frame_equal is more powerful as it checks dtypes as well, and has better error messages.

I found a few bugs (these are now fixed in different PRs), as well as found a few tests that weren't asserting the equality (simply df.frame_equal(expected) without the assert 😄 )

Random interesting tidbit

Different default dtypes for numpy arrays between Linux/Windows

# On Windows
>>> np.array([1, 2, 3]).dtype
dtype('int32')

# On Linux
>>> np.array([1, 2, 3]).dtype
dtype('int64')

This broke some tests, which I fixed by explicitly specifying the numpy dtype as np.int64.

@github-actions github-actions bot added python Related to Python Polars test Related to the test suite labels Jan 29, 2023
@stinodego stinodego marked this pull request as draft January 29, 2023 23:52
@stinodego stinodego force-pushed the assert-frame-equal branch 4 times, most recently from bd5bc1c to a944685 Compare January 30, 2023 10:20
@stinodego stinodego marked this pull request as ready for review January 30, 2023 10:20
@stinodego
Copy link
Member Author

@ritchie46 Can this be merged? It's pretty big so very sensitive to merge conflicts.

@ritchie46
Copy link
Member

Yes! And thanks for the cleanup. It did expose some bugs.

@ritchie46 ritchie46 merged commit 275642c into pola-rs:master Jan 30, 2023
Vincenthays pushed a commit to Vincenthays/polars that referenced this pull request Jan 30, 2023
Vincenthays pushed a commit to Vincenthays/polars that referenced this pull request Jan 30, 2023
@stinodego stinodego deleted the assert-frame-equal branch February 22, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Related to Python Polars test Related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants