Skip to content

Conversation

@tonyroberts
Copy link

@tonyroberts tonyroberts commented Apr 25, 2017

@jreback
Copy link
Contributor

jreback commented Apr 25, 2017

can u add a test? (e.g. pass in something like 'foo')

also can add a windows timezone test (like your issue) but need to skip if it in windows

and a whatsnew note -

bug fix section

offset = tzinfo.utcoffset(obj)
if offset is None:
raise NotImplementedError("Handling of tzinfo '%s' without "
"utcoffset not implemented" % tzinfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

can u use .format() for string formatting

Copy link
Author

Choose a reason for hiding this comment

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

done - I'll add a test shortly

@jreback jreback added Error Reporting Incorrect or improved errors from pandas Timezones Timezone data dtype labels Apr 25, 2017
@codecov
Copy link

codecov bot commented Apr 25, 2017

Codecov Report

Merging #16129 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## master #16129 +/- ## ========================================== - Coverage 90.86% 90.83% -0.03%  ========================================== Files 159 159 Lines 50771 50771 ========================================== - Hits 46133 46119 -14  - Misses 4638 4652 +14
Flag Coverage Δ
#multiple 88.61% <ø> (-0.03%) ⬇️
#single 40.33% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/plotting/_converter.py 63.54% <0%> (-1.82%) ⬇️
pandas/core/common.py 90.68% <0%> (-0.35%) ⬇️
pandas/core/indexes/datetimes.py 95.33% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d122e6...48c0a5a. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 25, 2017

Codecov Report

Merging #16129 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## master #16129 +/- ## ========================================== - Coverage 90.86% 90.83% -0.03%  ========================================== Files 159 159 Lines 50771 50771 ========================================== - Hits 46133 46119 -14  - Misses 4638 4652 +14
Flag Coverage Δ
#multiple 88.61% <ø> (-0.03%) ⬇️
#single 40.33% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/plotting/_converter.py 63.54% <0%> (-1.82%) ⬇️
pandas/core/common.py 90.68% <0%> (-0.35%) ⬇️
pandas/core/indexes/datetimes.py 95.33% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d122e6...48c0a5a. Read the comment docs.

tm.assert_numpy_array_equal(result, np.array(
[tslib.iNaT], dtype=np.int64))


Copy link
Contributor

@jreback jreback Apr 25, 2017

Choose a reason for hiding this comment

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

do like this:

# add to import at the top from pandas.compat import is_platform_windows @pytest.mark.skipif(not is_platform_windows(), reason="windows only") def test_win32_tz_object(): ..... 
Copy link
Contributor

Choose a reason for hiding this comment

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

use assert ut == expected (we are moving away from inherity from tm.TestCase entirely.

def test_win32_tz(self):
tz = win32timezone.TimeZoneInfo('Eastern Standard Time')
wt = pywintypes.TimeType(2008, 5, 12, 9, 50, tzinfo=tz)
tt = Timestamp(wt)
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this now raise NotImplementedError?

Copy link
Author

@tonyroberts tonyroberts Apr 25, 2017

Choose a reason for hiding this comment

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

No, it now falls through and gets the timezone correctly because of the NotImplementedError. That's raised when trying to get the fixed offset. It does however log that it's ignoring that error, which given that it's now working makes me think that actually raising that exception isn't the best thing to do.

I'll close this PR for now and re-open once I've had a chance to look at the best way to get this to work without logging warnings, and taking your feedback re the test cases into consideration.

@tonyroberts
Copy link
Author

Closing for now - will open a new one that handles the windows timezone objects correctly without logging warnings.

@jreback
Copy link
Contributor

jreback commented Apr 25, 2017

ok, just reopen this one. no need to create another

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Error Reporting Incorrect or improved errors from pandas Timezones Timezone data dtype

2 participants