-
Notifications
You must be signed in to change notification settings - Fork 269
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
can't compare datetime.datetime to datetime.date #340
Comments
This is absolutely a bug. |
@applecat I want to fix this bug, but I can't reproduce this behavior. |
Looks like the problem happens when comparing FakeDate and standard datetime objects
All comparisons should give TypeError |
I have this line in my code:
if self.begin and datetime.now() < self.begin:
And some tests for that code:
Tests passed, every thing is ok, but in production I've got this error:
Exception Value: can't compare datetime.datetime to datetime.date
I figured out that
self.begin
was adatetime.date
object, so python can't compare it to datetime.datetime.But in my tests I see comparison between
FakeDatetime
andFakeDate
and everything goes well:Is it expected behavior?
Can I catch this type of errors with freezegun?
The text was updated successfully, but these errors were encountered: