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

Fix tz.gettz() not returning local time for empty string #1024

Merged
merged 2 commits into from
Apr 24, 2020

Commits on Apr 24, 2020

  1. Fix tz.gettz() behavior with empty string

    The documented behavior of the function is to return a local time zone
    when the argument is None or an empty string.
    
    This was working if the TZ environment variable was set, but not working
    otherwise.
    
    Fixes dateutil#925, dateutil#926
    ffe4 authored and pganssle committed Apr 24, 2020
    Configuration menu
    Copy the full SHA
    bd69e8e View commit details
    Browse the repository at this point in the history
  2. Added property test for tz.gettz()

    The current tests only check that `tz.gettz()` and `tz.gettz("")` do
    the same thing, but not that the thing that they do is equivalent to a
    local time zone.
    
    Defining what is a "local time" is a bit complicated, considering that
    `tz.gettz()` may return a `tzfile` or a `tzlocal`, and neither of those
    have the same behavior as Python's built-in local time support via
    `.astimezone()`. This property test checks only the datetimes and
    properties that are expected to be the same between the various methods
    of getting a "local" time zone.
    ffe4 authored and pganssle committed Apr 24, 2020
    Configuration menu
    Copy the full SHA
    1fb2ea9 View commit details
    Browse the repository at this point in the history