Skip to content
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

feat(python): Enable generating data with time zones in parametric testing #16298

Merged
merged 7 commits into from
May 19, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented May 17, 2024

Changes

  • Add allow_time_zones parameter to series/dataframes/dtypes strategies. It's enabled by default.

Note that I'm avoiding the Datetime(time_zone="*") notation here because it's problematic in a number of ways. Instantiated data types should represent one specific data type, not match a whole bunch of data types. Unfortunately that does mean we have no good way to enable/disable time zones using allowed_dtypes/excluded_dtypes parameters, so I'm going with a separate parameter for this one.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels May 17, 2024
@stinodego stinodego marked this pull request as ready for review May 17, 2024 19:14
@@ -89,6 +89,7 @@ def dtypes(
*,
allowed_dtypes: Collection[PolarsDataType] | None = None,
excluded_dtypes: Sequence[PolarsDataType] | None = None,
allow_time_zones: bool = True,
Copy link
Member Author

Choose a reason for hiding this comment

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

Feels like we need a helper class at this point. Will probably refactor in the future.

@stinodego stinodego marked this pull request as draft May 17, 2024 19:23
Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 80.78%. Comparing base (11fe9d8) to head (748dade).
Report is 12 commits behind head on main.

Files Patch % Lines
...olars/polars/testing/parametric/strategies/data.py 88.23% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16298      +/-   ##
==========================================
- Coverage   80.80%   80.78%   -0.02%     
==========================================
  Files        1393     1393              
  Lines      179406   179375      -31     
  Branches     2921     2925       +4     
==========================================
- Hits       144971   144917      -54     
- Misses      33932    33955      +23     
  Partials      503      503              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stinodego stinodego marked this pull request as ready for review May 17, 2024 23:05
@stinodego stinodego merged commit 630d916 into main May 19, 2024
14 checks passed
@stinodego stinodego deleted the timezones branch May 19, 2024 13:00
@c-peters c-peters added the accepted Ready for implementation label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants