jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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()

To view, visit change 871263. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9b471d120956cb9adac1ecf179bfe0712d5d67e6
Gerrit-Change-Number: 871263
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged