Skip to content

BUG: is_normalized returned False for local tz #13484

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

Closed
wants to merge 1 commit into from
Closed

BUG: is_normalized returned False for local tz #13484

wants to merge 1 commit into from

Conversation

ravinimmi
Copy link
Contributor

@ravinimmi ravinimmi commented Jun 19, 2016

is_normalized returned False for normalized date_range
in case of local timezone 'Asia/Kolkata'
Fixes: #13459

@codecov-io
Copy link

codecov-io commented Jun 19, 2016

Current coverage is 84.33%

Merging #13484 into master will decrease coverage by <.01%

@@             master     #13484   diff @@
==========================================
  Files           138        138          
  Lines         51083      51106    +23   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43083      43102    +19   
- Misses         8000       8004     +4   
  Partials          0          0          

Powered by Codecov. Last updated by 3b75e03...4d48367

raise nose.SkipTest("timezone setting not supported on windows")

import os
import time
Copy link
Contributor

Choose a reason for hiding this comment

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

do this in a loop for several timezones (e.g. Asia/Kolka, US/Eastern, UTC)

@jreback jreback added Bug Timezones Timezone data dtype labels Jun 19, 2016
@@ -524,3 +524,5 @@ Bug Fixes


- Bug in ``Categorical.remove_unused_categories()`` changes ``.codes`` dtype to platform int (:issue:`13261`)

- Bug in ``tslib.dates_normalized`` returns False in case of normalized date_range for local timezone ``Asia/Kolkata`` (:issue:`13459`)
Copy link
Member

Choose a reason for hiding this comment

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

From user's point of view, it should describe the change related to DatetimeIndex.is_normalized. Also, it affects to all tz (not only to Kolkata).

@ravinimmi
Copy link
Contributor Author

@jreback Please review.


@contextmanager
def set_timezone(tz):
import os
Copy link
Contributor

Choose a reason for hiding this comment

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

add a doc-string with Parameters here (it must also be a string, so you should str(tz) somewhere.

@jreback
Copy link
Contributor

jreback commented Jun 20, 2016

looks good. just a few doc comments. ping when green.

@jreback jreback added this to the 0.18.2 milestone Jun 20, 2016
@jreback
Copy link
Contributor

jreback commented Jun 20, 2016

((pandas3.5)) C:\Users\conda\Documents\pandas3.5>nosetests pandas\tseries\tests\test_timezones.py
............................................................S.......................................................................E.....

======================================================================
ERROR: test_normalize_tz_local (pandas.tseries.tests.test_timezones.TestTimeZones)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\conda\Documents\pandas3.5\pandas\tseries\tests\test_timezones.py", line 1409, in test_normalize_tz_local
    with set_timezone(timezone):
  File "C:\Miniconda2\envs\pandas3.5\lib\contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "C:\Users\conda\Documents\pandas3.5\pandas\util\testing.py", line 2688, in set_timezone
    setTZ(tz)
  File "C:\Users\conda\Documents\pandas3.5\pandas\util\testing.py", line 2685, in setTZ
    time.tzset()
AttributeError: module 'time' has no attribute 'tzset'

----------------------------------------------------------------------
Ran 140 tests in 1.374s

FAILED (SKIP=1, errors=1)

so appears time.tzset() doesn't exist on windows (or maybe is called something else). If you can figure this out would be great.

If you can then we need to do a platform check inside the context manager and raise a Skiptest (though maybe just have the context manager raise something helpful and let the test writer worry about the skip)

is_normalized returned False for normalized date_range
in case of local timezone 'Asia/Kolkata'
Fixes: #13459
@ravinimmi
Copy link
Contributor Author

@jreback Its green. How does it look now?

@jreback jreback closed this in 1a12ead Jun 21, 2016
@jreback
Copy link
Contributor

jreback commented Jun 21, 2016

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test case failing - test_timezones.py:TestTimeZones.test_normalize_tz
4 participants