Skip to content

fix nightly build with Series.to_numpy() on a Timedelta series #500

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

Merged
merged 2 commits into from
Jan 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/test_timefuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
else:
FulldatetimeDict = Any
from tests import (
PD_LTE_15,
TYPE_CHECKING_INVALID_USAGE,
check,
pytest_warns_bounded,
Expand Down Expand Up @@ -652,7 +653,12 @@ def test_types_to_numpy() -> None:
td_s = pd.to_timedelta(pd.Series([10, 20]), "minutes")
check(assert_type(td_s.to_numpy(), np.ndarray), np.ndarray)
check(assert_type(td_s.to_numpy(dtype="int", copy=True), np.ndarray), np.ndarray)
check(assert_type(td_s.to_numpy(na_value=0), np.ndarray), np.ndarray)
if PD_LTE_15:
check(assert_type(td_s.to_numpy(na_value=0), np.ndarray), np.ndarray)
else:
check(
assert_type(td_s.to_numpy(na_value=pd.Timedelta(0)), np.ndarray), np.ndarray
Copy link
Member

Choose a reason for hiding this comment

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

Can we always use the else case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we always use the else case?

I tried that, and it didn't work, but now I tried again, and it did work! Must have done something wrong the first time.

Fixed in commit #c93d157

)


def test_to_timdelta_units() -> None:
Expand Down