GH-48654: [Python] Test timestamp from int without pandas dependency #48655
+37
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?
Rewrote the test to work both with and without pandas by:
@pytest.mark.pandasdecoratorpd.Timestampwith full nanosecond precisionas_py()raisesValueErrorfor valuesnot safely convertible to microseconds
Are these changes tested?
Yes. I manually tested with/without pandas:
Are there any user-facing changes?
No, test-only.