X Tutup
Skip to content

Fixes tzname return type#7705

Merged
tacaswell merged 1 commit intomatplotlib:masterfrom
Kojoley:issue-7630
Dec 29, 2016
Merged

Fixes tzname return type#7705
tacaswell merged 1 commit intomatplotlib:masterfrom
Kojoley:issue-7630

Conversation

@Kojoley
Copy link
Copy Markdown
Member

@Kojoley Kojoley commented Dec 29, 2016

Closes #7630

@Kojoley Kojoley added this to the 2.0.1 (next bug fix release) milestone Dec 29, 2016

def test_tz_utc():
dt = datetime.datetime(1970, 1, 1, tzinfo=mdates.UTC)
dt.tzname()
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member

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'                                                                                                                                                                                                                                                                                                                                                                  
>>>                                                                                                                                                                                                                                                                                                                                                                                                                                     
        

Copy link
Copy Markdown
Contributor

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.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 29, 2016

Current coverage is 62.07% (diff: 100%)

Merging #7705 into master will increase coverage by <.01%

@@             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          

Powered by Codecov. Last update d8f535c...e2a39ed

@tacaswell tacaswell merged commit 22708ef into matplotlib:master Dec 29, 2016
tacaswell added a commit that referenced this pull request Dec 29, 2016
FIX: Fixes tzname return type
@tacaswell
Copy link
Copy Markdown
Member

Thanks!

Backported to v2.x as c602d82

@tacaswell tacaswell modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Dec 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup