-
Notifications
You must be signed in to change notification settings - Fork 168
feat: Add testing.assert_frame_equal
#3220
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
base: main
Are you sure you want to change the base?
Conversation
# TODO(FBruzzesi): Do we even this? What should we check? | ||
# The best way could be to migrate away from `assert_equal_data` in the test suite | ||
def test_values_mismatch(constructor: Constructor) -> None: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking for help in finding edge cases here 😇
narwhals/testing/asserts/utils.py
Outdated
DataFramesDetail: TypeAlias = ( | ||
Literal[ | ||
"columns are not in the same order", | ||
"dtypes do not match", | ||
"height (row count) mismatch", | ||
"implementation mismatch", | ||
] | ||
| str | ||
# NOTE: `| str` makes the literals above redundant, but they still show | ||
# up when typing as autocompletion. | ||
# The reason to have `str` is due to the fact that other details are dynamic | ||
# and depend upon which columns lead to the assertion error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dangotbanned do you see a better way of doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first thought would be to keep the *Detail
aliases for static portion of the message.
I haven't looked through to see how the dynamic stuff works yet - particularly where it is sourced and where it gets inserted - but if you had these things separated into 2 parameters then it might work?
E.g. if you added another parameter with not_thing: str = ""
, that could just get skipped when empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example uses None
and adds line breaks when you have content
What type of PR is this? (check all applicable)
Related issues
assert_frame_equal
#3129assert_series_equal
#2983assert_equal_data
toassert_frame_equal
#3221Checklist
If you have comments or can explain your changes, please do so below
50%+ of the changes are docstrings and tests