jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/398882 )
Change subject: [doc] Print a more understandable error message
......................................................................
[doc] Print a more understandable error message
- currently type checking of the color_format text value may give the message
"expected str got <type 'str'>" for python 2 which is a bit confusing.
- now it gives "expected <type 'unicode'> got <type 'str'>" for python 2 and
"expected <class 'str'> got <class 'bytes'>" in python 3 which is more
accurate
Change-Id: Id3c07760c6c8d5ec611975c4d9d0c34a65466f7d
---
M pywikibot/tools/formatter.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index 149454b..cd8b96c 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -156,7 +156,8 @@
raise ValueError('Keyword argument(s) use valid color(s): ' +
'", "'.join(self.colors.intersection(kwargs)))
if not isinstance(format_string, UnicodeType):
- raise TypeError('expected str, got
{0}'.format(type(format_string)))
+ raise TypeError('expected {0}, got {1}'
+ .format(type(''), type(format_string)))
return super(_ColorFormatter, self).vformat(format_string, args,
kwargs)
--
To view, visit https://gerrit.wikimedia.org/r/398882
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id3c07760c6c8d5ec611975c4d9d0c34a65466f7d
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: Zoranzoki21 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits