Skip to content

Adapt test_dataset_math_errors for coming NumPy behavior change - #11435

Merged
spencerkclark merged 2 commits into
pydata:mainfrom
spencerkclark:generic-datetime
Jul 3, 2026
Merged

Adapt test_dataset_math_errors for coming NumPy behavior change#11435
spencerkclark merged 2 commits into
pydata:mainfrom
spencerkclark:generic-datetime

Conversation

@spencerkclark

Copy link
Copy Markdown
Member

Description

This PR adapts test_dataset_math_errors for coming updates in NumPy. We can no longer rely on arithmetic between datetime64 values and plain integers working without a warning or error.

My understanding of this test is that we want adding a datetime64 value to "bar" to succeed so that we can check that the failure in adding a datetime64 value to "foo" prevents updating any variable in the Dataset. Therefore we explicitly cast "bar" to an array of "timedelta64[ns]" values so that this continues to be the case moving forward.

Even though it is not strictly necessary, we also provide units in the datetime64 constructor when creating other.

Addresses one part of #11402.

@spencerkclark spencerkclark added the run-upstream Run upstream CI label Jul 3, 2026
@spencerkclark spencerkclark changed the title Adapt test_dataset_math_errors for coming NumPy changes Adapt test_dataset_math_errors for coming NumPy behavior change Jul 3, 2026
@spencerkclark
spencerkclark merged commit 030c929 into pydata:main Jul 3, 2026
31 of 43 checks passed
@spencerkclark
spencerkclark deleted the generic-datetime branch July 3, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-upstream Run upstream CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants