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

clean: (partial) factor test_common #482

Merged
merged 4 commits into from
Jul 10, 2024
Merged

Conversation

FBruzzesi
Copy link
Member

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below.

Unsure how to handle to_pandas and to_numpy failures

Comment on lines +22 to +25
if constructor_with_pyarrow.__name__.startswith("pandas"):
expected = constructor_with_pyarrow(data)
else:
expected = pd.DataFrame(data)
Copy link
Member Author

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

Copy link
Member

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

Comment on lines +11 to +16
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)
Copy link
Member Author

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

@FBruzzesi FBruzzesi marked this pull request as ready for review July 10, 2024 15:13
@FBruzzesi FBruzzesi changed the title clean: partially factor test_common clean: (partial) factor test_common Jul 10, 2024
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

solid effort, thanks so much for doing this πŸ’ͺ

Comment on lines +13 to +16
@pytest.mark.skipif(
parse_version(pd.__version__) < parse_version("2.0.0"),
reason="too old for pandas-pyarrow",
)
Copy link
Member

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

Comment on lines +22 to +25
if constructor_with_pyarrow.__name__.startswith("pandas"):
expected = constructor_with_pyarrow(data)
else:
expected = pd.DataFrame(data)
Copy link
Member

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

@MarcoGorelli MarcoGorelli merged commit 0b96ff1 into main Jul 10, 2024
19 checks passed
@FBruzzesi FBruzzesi deleted the clean/factor-test-common branch July 10, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants