-
Notifications
You must be signed in to change notification settings - Fork 89
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
clean: (partial) factor test_common
#482
Conversation
if constructor_with_pyarrow.__name__.startswith("pandas"): | ||
expected = constructor_with_pyarrow(data) | ||
else: | ||
expected = pd.DataFrame(data) |
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.
I am not too happy with this, but asserting_frame_equal
clearly takes the backend into consideration.
Alternative would be to just check for values
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.
looks good, not sure what else we can do here
data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.1, 8, 9]} | ||
df_raw = constructor(data) | ||
result = nw.from_native(df_raw, eager_only=True).to_numpy() | ||
|
||
expected = np.array([[1, 3, 2], [4, 4, 6], [7.1, 8, 9]]).T | ||
np.testing.assert_array_equal(result, expected) |
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.
pandas_nullable
and pandas_pyarrow
will convert 7.0
to integer, therefore the type check fails. Using 7.1
fixes that
test_common
test_common
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.
@pytest.mark.skipif( | ||
parse_version(pd.__version__) < parse_version("2.0.0"), | ||
reason="too old for pandas-pyarrow", | ||
) |
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.
maybe we should be using request
and only skipping the elements of constructor
where this fails...but ok for a follow-up
if constructor_with_pyarrow.__name__.startswith("pandas"): | ||
expected = constructor_with_pyarrow(data) | ||
else: | ||
expected = pd.DataFrame(data) |
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.
looks good, not sure what else we can do here
What type of PR is this? (check all applicable)
Related issues
test_common.py
Β #401Checklist
If you have comments or can explain your changes, please do so below.
Unsure how to handle
to_pandas
andto_numpy
failures