You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noticed that as soon as you import freeze_time then calls to datetime.now() or date.today() will be return instances of FakeDatetime or FakeDate without a decorator of context manager (or raw start/stop) being invoked.
I.e. these tests (revised from your tests) should both pass (if I understand correctly):
The lines assert not isinstance(now, FakeDatetime) and assert not isinstance(now, FakeDate) are not expected to pass. Once freeze_time is imported, all datetime/date instances will be instances of FakeDatetime/FakeDate and all references to datetime.datetime/datetime.date will actually be references to the classes FakeDatetime/FakeDate.
The thought is that this will all go on transparently behind the scenes and people will be able to just think of it all as datetime.datetime. Feel free to reopen if this is somehow causing issues in your test writing.
Hi Steve,
Noticed that as soon as you import freeze_time then calls to datetime.now() or date.today() will be return instances of FakeDatetime or FakeDate without a decorator of context manager (or raw start/stop) being invoked.
I.e. these tests (revised from your tests) should both pass (if I understand correctly):
However,
test_isinstance_without_active
fails because now and today are Fake.The text was updated successfully, but these errors were encountered: