Replies: 1 comment 2 replies
-
@ratkins, did you find any solution? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Apparently, when I annotate a
datetime
field in aBaseModel
subclass and Pydantic creates the object for me, the runtime type of the datetime field is the (private) Pydantic typeTzInfo
.Unfortunately, this doesn't compare as equal to the object I get back from creating one with
datetime.timezone(timedelta(hours=1))
. Which means my.assert_called_with()
assertion fails in my test, even when the objects legitimately represent the same instant:Can I somehow instruct pydantic to construct a canonicalised
datetime
object I can compare with adatetime
object it's possible to construct myself?Beta Was this translation helpful? Give feedback.
All reactions