Skip to content

TST: add test for non UTC datetime split #14042 #32866

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

Merged
merged 2 commits into from
Mar 21, 2020

Conversation

JDkuba
Copy link
Contributor

@JDkuba JDkuba commented Mar 20, 2020


def test_split_non_utc(self):
indices = pd.date_range("2016-01-01 00:00:00+0200", freq="S", periods=10)
split_indices = np.split(indices, indices_or_sections=[])
Copy link
Member

Choose a reason for hiding this comment

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

Could you name these variables result and expected so the comparison below can be

tm.assert_index_equal(result, expected)

Copy link
Member

Choose a reason for hiding this comment

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

are there enough functions like np.split to merit a file like tests.indexes.datetimes.test_numpy_compat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mroeschke right, done.

@jbrockmendel np.split is the only function I know for which such an issue occurred. But this is my first PR for this project so maybe there are others that I haven't noticed.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Mar 20, 2020
@jreback jreback added this to the 1.1 milestone Mar 20, 2020
"2016-01-01 00:00:08+02:00",
"2016-01-01 00:00:09+02:00",
]
)
Copy link
Member

Choose a reason for hiding this comment

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

this is the same as indices but without a a freq, right? if so, can you construct it as

expected = index.copy()
expected._set_freq(None)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks

@jreback jreback merged commit 87cf295 into pandas-dev:master Mar 21, 2020
@jreback
Copy link
Contributor

jreback commented Mar 21, 2020

thanks @JDkuba

SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

numpy.split on non-UTC, tz-aware data undergoes UTC roundtrip
4 participants