Return None from tzlocal.tzname(None) when the zone has DST (#1674)

datetime.time objects have no date, so they pass None to the tzinfo
methods. When the local zone observes DST, tzlocal.utcoffset() and
tzlocal.dst() already return None for that, but tzname() passed None on
to _isdst(), so time(13, 20, tzinfo=tz.tzlocal()).tzname() and
.strftime("%Z") raised "AttributeError: 'NoneType' object has no
attribute 'replace'".

Return None from tzname() under the same condition as the other two
methods. This matches tzfile, which returns None from all three for
zones with transitions. Zones without DST still return their standard
abbreviation.
4 files changed