8000 BUG: preserve fold in Timestamp.replace by AlexKirko · Pull Request #37644 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: preserve fold in Timestamp.replace #37644

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 9 commits into from
Nov 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations< 8000 /strong>
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TST: add test
  • Loading branch information
AlexKirko committed Nov 5, 2020
commit 096ee9b8a07e0bf7d294fe9593cad5e120018a98
10 changes: 10 additions & 0 deletions pandas/tests/indexes/datetimes/test_timezones.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,3 +1190,13 @@ def test_tz_localize_invalidates_freq():
dti2 = dti[:1]
result = dti2.tz_localize("US/Eastern")
assert result.freq == "H"


def test_replace_preserves_fold():
Copy link
Contributor

Choose a reason for hiding this comment

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

should go here: pandas/tests/scalar/timestamp/test_unary_ops.py (there is another replace test)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

# GH 37610. Check that replace preserves Timestamp fold property
tz = gettz("Europe/Moscow")

result = Timestamp(1256427000000000000, tz=tz, unit="ns").replace(tzinfo=tz).fold
expected = 1

assert result == expected
0