mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
change test_parse encoding to UTF-8
This commit is contained in:
parent
2c3c794e52
commit
b5111453d8
2 changed files with 12 additions and 12 deletions
|
|
@ -99,7 +99,7 @@ class HtmlPrettyPrinter (object):
|
|||
@type attrs: dict
|
||||
@return: None
|
||||
"""
|
||||
self._start_element(tag, attrs, ">")
|
||||
self._start_element(tag, attrs, u">")
|
||||
|
||||
def start_end_element (self, tag, attrs, element_text=None):
|
||||
"""
|
||||
|
|
@ -111,7 +111,7 @@ class HtmlPrettyPrinter (object):
|
|||
@type attrs: dict
|
||||
@return: None
|
||||
"""
|
||||
self._start_element(tag, attrs, "/>")
|
||||
self._start_element(tag, attrs, u"/>")
|
||||
|
||||
def _start_element (self, tag, attrs, end):
|
||||
"""
|
||||
|
|
@ -125,12 +125,12 @@ class HtmlPrettyPrinter (object):
|
|||
@type end: string
|
||||
@return: None
|
||||
"""
|
||||
self.fd.write("<%s" % tag.replace("/", ""))
|
||||
self.fd.write(u"<%s" % tag.replace("/", ""))
|
||||
for key, val in attrs.items():
|
||||
if val is None:
|
||||
self.fd.write(" %s" % key)
|
||||
self.fd.write(u" %s" % key)
|
||||
else:
|
||||
self.fd.write(' %s="%s"' % (key, quote_attrval(val)))
|
||||
self.fd.write(u' %s="%s"' % (key, quote_attrval(val)))
|
||||
self.fd.write(end)
|
||||
|
||||
def end_element (self, tag):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# -*- coding: iso-8859-1 -*-
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (C) 2004-2012 Bastian Kleineidam
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -54,9 +54,9 @@ parsetests = [
|
|||
("""< a >""", """< a >"""),
|
||||
("""<>""", """<>"""),
|
||||
("""< >""", """< >"""),
|
||||
("""<aä>""", u"""<aä></aä>"""),
|
||||
("""<a aä="b">""", u"""<a aä="b"></a>"""),
|
||||
("""<a a="bä">""", u"""<a a="bä"></a>"""),
|
||||
("""<aä>""", u"""<aä></aä>"""),
|
||||
("""<a aä="b">""", u"""<a aä="b"></a>"""),
|
||||
("""<a a="bä">""", u"""<a a="bä"></a>"""),
|
||||
# multiple attribute names should be ignored...
|
||||
("""<a b="c" b="c" >""", """<a b="c"></a>"""),
|
||||
# ... but which one wins - in our implementation the last one
|
||||
|
|
@ -97,7 +97,7 @@ parsetests = [
|
|||
("""</a >""", """"""),
|
||||
("""< / a>""", """< / a>"""),
|
||||
("""< /a>""", """< /a>"""),
|
||||
("""</aä>""", """"""),
|
||||
("""</aä>""", """"""),
|
||||
# start and end tag (HTML doctype assumed)
|
||||
("""<a/>""", """<a></a>"""),
|
||||
("""<meta/>""", """<meta/>"""),
|
||||
|
|
@ -144,8 +144,8 @@ parsetests = [
|
|||
# note that \u8156 is not valid encoding and therefore gets removed
|
||||
("""<a href="῜ailto:" >""", """<a href="῜ailto:"></a>"""),
|
||||
# non-ascii characters
|
||||
("""<Üzgür> fahr </langsamer> ¿¿¿¿¿¿{""",
|
||||
u"""<Üzgür> fahr ¿¿¿¿¿¿{"""),
|
||||
("""<Üzgür> fahr </langsamer> żżżżżż{""",
|
||||
u"""<Üzgür> fahr żżżżżż{"""),
|
||||
# mailto link
|
||||
("""<a href=mailto:calvin@LocalHost?subject=Hallo&to=michi>1</a>""",
|
||||
"""<a href="mailto:calvin@LocalHost?subject=Hallo&to=michi">1</a>"""),
|
||||
|
|
|
|||
Loading…
Reference in a new issue