-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-48654: [Python] Test timestamp from int without pandas dependency #48655
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
Conversation
|
|
e262d9a to
e48dc82
Compare
e48dc82 to
a69c360
Compare
AlenkaF
left a comment
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.
Happy New Year! =)
Thank you for another contribution ❤️ The change looks good to me. The existing test is kept as is with only the nanosecond case excluded and turned into two separate (pandas and nopandas) tests in order to check the code path when pandas is not installed.
One question I have is: I think the case where pandas is not installed and nanosecond int value can be divided by 1000 is not included in the tests? Can we add that?
|
Thank you ! let me take a look! |
|
Updated the PR description as well 👍 |
AlenkaF
left a comment
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.
Thanks!
|
yay! |
|
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 7ba1a7b. There weren't enough matching historic benchmark results to make a call on whether there were regressions. The full Conbench report has more details. |
Rationale for this change
The test
test_sequence_timestamp_from_int_with_unit()was marked with@pytest.mark.pandas, meaning it was skipped when pandas was not installed.This left the non-pandas code path untested.
Specifically in order to test:
arrow/python/pyarrow/scalar.pxi
Lines 652 to 661 in 744f0ec
The TODO was introduced in commit 286bf7c when making pandas
an optional dependency:
arrow/python/pyarrow/tests/test_convert_builtin.py
Lines 731 to 732 in 286bf7c
What changes are included in this PR?
Split nanosecond timestamp testing into separate tests to cover both pandas and non-pandas code paths:
test_sequence_timestamp_from_int_with_unit()unchanged (tests s/ms/us units without pandas requirement)test_sequence_timestamp_from_int_with_unit_nanosecond(@pytest.mark.pandas): Testspd.Timestampwith full nanosecond precisiontest_sequence_timestamp_from_int_nanosecond_without_pandas(@pytest.mark.nopandas): Tests that values not divisible by 1000 raiseValueErrortest_sequence_timestamp_from_int_nanosecond_divisible_without_pandas(@pytest.mark.nopandas): Tests successful conversion when values are divisible by 1000Are these changes tested?
Yes. I manually tested with/without pandas:
Are there any user-facing changes?
No, test-only.