Skip to content
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

Using tz_offset breaks t == fromtimestamp(t).timestamp() #344

Closed
Strilanc opened this issue Apr 1, 2020 · 0 comments · Fixed by #475
Closed

Using tz_offset breaks t == fromtimestamp(t).timestamp() #344

Strilanc opened this issue Apr 1, 2020 · 0 comments · Fixed by #475
Labels

Comments

@Strilanc
Copy link

Strilanc commented Apr 1, 2020

import freezegun

def test_without_freezegun():
    t = datetime.datetime.now().timestamp()
    t2 = datetime.datetime.fromtimestamp(t).timestamp()
    assert t == t2  # PASS


@freezegun.freeze_time(datetime.datetime.fromtimestamp(100_000), tz_offset=-1)
def test_with_freezegun():
    t = datetime.datetime.now().timestamp()
    t2 = datetime.datetime.fromtimestamp(t).timestamp()
    assert t == t2  # FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants