mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-14 01:23:11 +00:00
Remove LinkCheckTest.fail_unicode()
No need to encode Python 3 strings before output.
This commit is contained in:
parent
0752408a44
commit
10552a79c7
1 changed files with 3 additions and 10 deletions
|
|
@ -244,18 +244,11 @@ class LinkCheckTest (unittest.TestCase):
|
|||
diff = logger.diff
|
||||
if diff:
|
||||
msg = str_text(os.linesep).join([url] + diff)
|
||||
self.fail_unicode(msg)
|
||||
self.fail(msg)
|
||||
if logger.stats.internal_errors:
|
||||
self.fail_unicode("%d internal errors occurred!"
|
||||
self.fail("%d internal errors occurred!"
|
||||
% logger.stats.internal_errors)
|
||||
|
||||
def fail_unicode (self, msg):
|
||||
"""Print encoded fail message."""
|
||||
# XXX self.fail() only supports ascii on Python 2
|
||||
if not isinstance(msg, str) and isinstance(msg, str_text): # this can be true only on Python 2
|
||||
msg = msg.encode("ascii", "backslashreplace")
|
||||
self.fail(msg)
|
||||
|
||||
def direct (self, url, resultlines, parts=None, recursionlevel=0,
|
||||
confargs=None, url_encoding=None):
|
||||
"""Check url with expected result."""
|
||||
|
|
@ -277,7 +270,7 @@ class LinkCheckTest (unittest.TestCase):
|
|||
if diff:
|
||||
l = ["Differences found testing %s" % url]
|
||||
l.extend(x.rstrip() for x in diff[2:])
|
||||
self.fail_unicode(str_text(os.linesep).join(l))
|
||||
self.fail(str_text(os.linesep).join(l))
|
||||
|
||||
|
||||
class MailTest (LinkCheckTest):
|
||||
|
|
|
|||
Loading…
Reference in a new issue