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

Mock Pandas Timestamp now/utcnow/today methods #426

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Liam3851
Copy link

Patch to solve #298. Freeze_time patches the pandas Timestamp, now, utcnow, and today methods if pandas is available on the system (i.e. an import pandas call does not fail) and has no effect if pandas is not installed.

The mocks are generated by wrapping the equivalent calls from FakeDatetime in a Timestamp constructor, so ticking/etc. functionality from the original class should flow directly. However, the mocked return value of Timestamp.now, Timestamp.today, and Timestamp.utcnow is currently Timestamp, but not FakeDatetime. If the latter is necessary (e.g. if it's contracted that any freezegun'd value is always a FakeDate/FakeDatetime) I can revise the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant