-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: start tests for PeriodConverter #9055
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
TST: start tests for PeriodConverter #9055
Conversation
b69b9d3 (obviously you have more) |
yep, I saw that. But I thought to add it both as a test for PeriodConverter (which then seemed to not yet exist), and as a plotting test (but only came around to the first one yesterday, and you already did the second). |
@jorisvandenbossche thought you had merged this, looks ok |
there are two parts skipped for now in this PR:
|
raise nose.SkipTest("PeriodConverter does not yet handle unicode") | ||
r1 = self.pc.convert("2012-1-1", None, self.axis) | ||
r2 = self.pc.convert(u("2012-1-1"), None, self.axis) | ||
self.assert_equal(r1, r2, "PeriodConverter.convert should accept 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.
Never used PeriodConverter
but the undelrying supports, so maybe just a small issue
In [1]: pd.Timestamp(u'20121201')
Out[1]: Timestamp('2012-12-01 00:00:00')
In [2]: pd.Period(u'20121201',freq='D')
Out[2]: Period('2012-12-01', 'D')
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.
It is actually a quite simple reason. From https://github.com/pydata/pandas/blob/master/pandas/tseries/converter.py#L112:
valid_types = (str, datetime, Period, pydt.date, pydt.time)
if isinstance(values, valid_types):
....
here of course testing for str
does not work for unicode
I will add this
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 just have to use pd.compat.string_types
instead of str
?
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.
yep
440a3df
to
29cb1f7
Compare
TST: start tests for PeriodConverter
@jreback The tests I started related to PR #9050