HypothesisWorks / hypothesis

Hypothesis is a powerful, flexible, and easy to use library for property-based testing.
https://hypothesis.works
Other
7.39k stars 578 forks source link

`hypothesis.extra.pandas`: generate timezone-aware datetime columns #4020

Open keewis opened 1 week ago

keewis commented 1 week ago

In pydata/xarray#9174, I've been trying to find a way to generate timezone-aware datetime columns using pdst.column, where the entire column would have the same timezone: I believe pandas doesn't support varying timezones outside of the object dtype.

However, it doesn't seem like hypothesis.extra.pandas currently supports this using pdst.column (I didn't check whether the creation of timezone-aware datetime indexes would work, though).

Would it be possible to add something to that end?

Not sure how that would look API-wise, but in addition to a timezone strategy, I'd also like to be able to specify the datetime unit (since xarray is currently restricted to just nanosecond resolution).