-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: Make understandable assertion messages #10373
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
Comments
Maybe just list differences?
so that if there are multiple issues, one might see
so that an assertion could do a full DataFrame comparison before deciding to assert, rather than asserting on the first diff found (which can mean many iterations when there are multiple problems) |
I think there are 2 approaches, and now I feel option 2 is preferable. 1. Use current assertion function internally, and output detail when it fails.This should not increase testing time so much.
2. Output more understandable errors in each assertion steps (not output whole differences)This is like what numpy does. |
Agreed that option 2 is better. Option 1 is a path to madness. |
agreed, a slightly more informative |
Let me summarize the idea based on option 2 comparing to the
IndexCurrently, pandas always shows the same assertion like below:
Changing assertion message to indicate what the difference is based on following 3 points like
SeriesMessages are different based on the category as below, but it is not enough clear.
DataFrameMessages are different based on the category as below, but it is not enough clear.
Preferable message format
for example:
|
I think making assertion messages more understandable helps users who is starting contribution / using
pandas
as their dependencies. I'm considering examples like power assert, but more focuses what's differences are.If it worth to be discussed, I'll prepare more examples to fix the specifications.
First target should be:
assert_frame_equal
assert_series_equal
assert_index_equal
The text was updated successfully, but these errors were encountered: