-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixes tzname return type #7705
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
Fixes tzname return type #7705
Conversation
@@ -465,6 +465,11 @@ def test_DayLocator(): | |||
mdates.DayLocator(interval=1.0) | |||
|
|||
|
|||
def test_tz_utc(): | |||
dt = datetime.datetime(1970, 1, 1, tzinfo=mdates.UTC) | |||
dt.tzname() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check the return value of dt.tzname()
rather than making this just a smoke test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should add that my big complaint here is that this test, while exercising the method, does nothing to actually catch the original problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does, the exception is coming out of datetime
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:09:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import matplotlib.dates as mdates
>>> import datetime
>>> dt = datetime.datetime(1970, 1, 1, tzinfo=mdates.UTC)
>>> dt.tzname()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: tzinfo.tzname() must return None or a string, not 'unicode'
>>>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AH. I see now. My mistake.
Current coverage is 62.07% (diff: 100%)@@ master #7705 diff @@
==========================================
Files 174 174
Lines 56022 56022
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 34776 34777 +1
+ Misses 21246 21245 -1
Partials 0 0
|
FIX: Fixes tzname return type
Thanks! Backported to v2.x as c602d82 |
Closes #7630