jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/871263 )
Change subject: [bugfix] Add Timestamp.__repr__() method to unify the result ......................................................................
[bugfix] Add Timestamp.__repr__() method to unify the result
Unify representation for Timestamp object which is different between CPython and Pypy
Bug: T325905 Change-Id: I9b471d120956cb9adac1ecf179bfe0712d5d67e6 --- M pywikibot/time.py 1 file changed, 18 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/time.py b/pywikibot/time.py index 63bca0d..e96a5f7 100644 --- a/pywikibot/time.py +++ b/pywikibot/time.py @@ -293,6 +293,11 @@ """ return f'{self.posix_timestamp():.6f}'
+ def __repr__(self) -> str: + """Unify repr string between CPython and Pypy (T325905).""" + s = super().__repr__() + return f'{type(self).__name__}{s[s.find("("):]}' + def __str__(self) -> str: """Return a string format recognized by the API.""" return self.isoformat()