-
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
consider overriding == on FakeDatetimeMeta #549
Comments
I did a quick search but didn't find any prior issues on this topic. If this is a repeat, maybe it would be a good idea to add a comment or docstring explaining why overriding |
Also, thanks very much for maintaining this open source library! I appreciate your generosity. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just spent an hour debugging a weird interaction with
datetime != datetime
the first time a particular branch of code got run inside afreezegun
block.My fix (after much fiddling around) was
issubclass(type_, datetime)
instead oftype_ == datetime
.I notice that
FakeDatetimeMeta
overrides__instancecheck__
and__subclasscheck__
to appear to be a datetime. Has it also been discussed overriding__eq__
?Here's what the class would look like with the new method:
https:/spulec/freezegun/blob/master/freezegun/api.py#L355-L362
Here's fiddling around at the REPL to double-check overriding
__eq__
on a metaclass works as expected (at least in newer Python 3):The text was updated successfully, but these errors were encountered: