8000 Add tests for time conversions in tools package by markcampanelli · Pull Request #2341 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Add tests for time conversions in tools package #2341

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 48 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9347f12
Add tests for tools.localize_to_utc
markcampanelli Dec 23, 2024
0638773
Add tests for datetime_to_djd and djd_to_datetime
markcampanelli Dec 23, 2024
c1df9a7
Update what's new
markcampanelli Dec 23, 2024
77c0f81
Appease the linter
markcampanelli Dec 23, 2024
6704d06
Fix pandas equality tests for Python 3.9
markcampanelli Dec 23, 2024
dbb1805
Fix pandas equality tests for Python 3.9 more
markcampanelli Dec 23, 2024
6750709
Fix pandas equality tests for Python 3.9 more more
markcampanelli Dec 23, 2024
1144106
Bump miniimum pandas to fix bad test failure
markcampanelli Dec 23, 2024
14715ed
Try alternative pandas test fix
markcampanelli Dec 23, 2024
545c196
Revert change in minimum pandas version
markcampanelli Dec 23, 2024
271fd97
Fix test
markcampanelli Dec 23, 2024
01263c2
Type Location's tz and pytz attributes as advertised
markcampanelli Dec 23, 2024
60a5d94
Add timezone type checks to Location init test
markcampanelli Dec 23, 2024
9ab2ecf
Don't parameterize repetitive tests
markcampanelli Dec 24, 2024
ddef8d1
Update whatsnew for Location bugfix
markcampanelli Dec 24, 2024
4f17f49
Update docstring
markcampanelli Dec 24, 2024
a3c3e03
Improve whatsnew formatting
markcampanelli Dec 24, 2024
5f59417
Support non-fractional int and float and pytz and zoneinfo time zones
markcampanelli Jan 9, 2025
c84801f
Appease the linter
markcampanelli Jan 9, 2025
195efbc
Use zoneinfo as single source of truth and tz as interface point
markcampanelli Jan 10, 2025
1a5efed
Add zoneinfo asserts in tests
markcampanelli Jan 10, 2025
e5af9ae
Try to fix asv ci
markcampanelli Jan 10, 2025
67e9844
See if newer asv works with newer conda
markcampanelli Jan 10, 2025
e35eb42
Remove comments no longer needed
markcampanelli Jan 10, 2025
a1a0261
Remove addition of zoneinfo attribute
markcampanelli Jan 10, 2025
8373ac4
Revise whatsnew bugfix
markcampanelli Jan 10, 2025
eee6f51
Revise whatsnew bugfix more
markcampanelli Jan 10, 2025
9662c1f
Spell my name correctly
markcampanelli Jan 10, 2025
32284ba
The linter strikes back again
markcampanelli Jan 10, 2025
01e4cfc
Merge branch 'main' into add_tools_tests
markcampanelli Jan 27, 2025
c09a328
Fix whatsnew after main merge
markcampanelli Jan 27, 2025
4ef4b69
Address Cliff's comment
markcampanelli Jan 28, 2025
7490792
Adjust Location documentation
markcampanelli Jan 28, 2025
a5f7646
Fix indent
markcampanelli Jan 28, 2025
1382e30
More docstring tweaks
markcampanelli Jan 28, 2025
059e35f
Try to fix bad parens
markcampanelli Jan 28, 2025
f9f07d7
Rearrange docstring
markcampanelli Jan 28, 2025
75db2aa
Appease the linter
markcampanelli Jan 28, 2025
1164c96
Document pytz attribute as read only
markcampanelli Jan 28, 2025
5f6ad14
Consistent read only
markcampanelli Jan 28, 2025
f691bb6
Update pvlib/location.py per review comment
markcampanelli Jan 28, 2025
7cfb170
Add breaking change to whatsnew and fix linting
markcampanelli Jan 28, 2025
ef5c60f
Clarify breaking change in whatsnew
markcampanelli Feb 5, 2025
c96c018
Merge branch 'main' into add_tools_tests
markcampanelli Mar 9, 2025
5d4be75
Update whatsnew ordering
markcampanelli Mar 9, 2025
5d5e553
Implement review comments on documentation
markcampanelli Mar 9, 2025
6d83e16
Missed saving changes and appease the linter
markcampanelli Mar 9, 2025
d26204f
Apply suggestions from code review
cwhanse Mar 9, 2025
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
Prev Previous commit
Next Next commit
Add breaking change to whatsnew and fix linting
  • Loading branch information
markcampanelli committed Jan 28, 2025
commit 7cfb170b297b2d87f930f07e2abf6a2a286a95e3
16 changes: 11 additions & 5 deletions docs/sphinx/source/whatsnew/v0.11.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ Enhancements

Bug Fixes
~~~~~~~~~
* Ensure proper tz and pytz types in pvlib.location.Location. tz becomes the
single source of time-zone truth, is the single time-zone setter interface,
and the getter consistently returns an IANA string. datetime.tzinfo
subclasses are fully supported in tz setter. pytz attribute becomes read
only. (:issue:`2340`, :pull:`2341`)
* Ensure proper tz and pytz types in pvlib.location.Location.
(:issue:`2340`, :pull:`2341`)


Documentation
Expand All @@ -43,6 +40,15 @@ Maintenance
* asv 0.4.2 upgraded to asv 0.6.4 to fix CI failure due to pinned older conda.
(:pull:`2352`)

Breaking Changes
~~~~~~~~~~~~~~~~
* To ensure that the time zone in pvlib.location.Location remains internally
consistent if/when the time zone is updated, the tz attribute becomes the
single source of time-zone truth, is the single time-zone setter interface,
and its getter consistently returns an IANA string. datetime.tzinfo
subclasses (including time zones from pytz and zoneinfo) are still fully
supported in the tz setter, but the pytz attribute becomes read only.
(:issue:`2340`, :pull:`2341`)
Copy link
Member
@cwhanse cwhanse Jan 28, 2025

Choose a reason for hiding this comment

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

Suggested change
* To ensure that the time zone in pvlib.location.Location remains internally
consistent if/when the time zone is updated, the tz attribute becomes the
single source of time-zone truth, is the single time-zone setter interface,
and its getter consistently returns an IANA string. datetime.tzinfo
subclasses (including time zones from pytz and zoneinfo) are still fully
supported in the tz setter, but the pytz attribute becomes read only.
(:issue:`2340`, :pull:`2341`)
* The pytz attribute of pvlib.location.Location is now read only. Use the tz attribute
to record time zone. The pytz attribute is internally updated if the tz attribute
is changed.
* The tz attribute of pvlib.location.Location now returns an IANA string.
(:issue:`2340`, :pull:`2341`)

I think the focus of this note should be on how the changes will affect user code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the whatsnew, trying to focus on the breaking change and its workaround, and also trying to provide the context behind the associated bugfix.


Contributors
~~~~~~~~~~~~
Expand Down
3 changes: 2 additions & 1 deletion pvlib/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class Location:
* ``tz`` is an IANA time-zone string.
* ``pytz`` is a pytz-based time-zone object (read only).

The read-only ``pytz`` attribute will stay in sync with any changes made using ``tz``.
The read-only ``pytz`` attribute will stay in sync with any changes made
using ``tz``.

Location objects support the print method.

Expand Down
0