summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bs4/element.py4
-rw-r--r--bs4/tests/test_html5lib.py2
-rw-r--r--bs4/tests/test_lxml.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 8451d7c..7c72894 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -400,7 +400,7 @@ class NavigableString(unicode, PageElement):
if substitute_html_entities:
output = EntitySubstitution.substitute_html(self)
else:
- output = self
+ output = EntitySubstitution.substitute_xml(self)
return self.PREFIX + output + self.SUFFIX
@@ -668,7 +668,7 @@ class Tag(PageElement):
def __str__(self):
return self.encode()
-
+
if PY3K:
__str__ = __repr__ = __unicode__
diff --git a/bs4/tests/test_html5lib.py b/bs4/tests/test_html5lib.py
index b136ba0..5b1d1e4 100644
--- a/bs4/tests/test_html5lib.py
+++ b/bs4/tests/test_html5lib.py
@@ -149,7 +149,7 @@ class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup):
def test_incomplete_declaration(self):
# An incomplete declaration is treated as a comment.
markup = 'a<!b <p>c'
- self.assertSoupEquals(markup, "a<!--b <p-->c")
+ self.assertSoupEquals(markup, "a<!--b &lt;p-->c")
# Let's spell that out a little more explicitly.
soup = self.soup(markup)
diff --git a/bs4/tests/test_lxml.py b/bs4/tests/test_lxml.py
index d1f4276..0adef20 100644
--- a/bs4/tests/test_lxml.py
+++ b/bs4/tests/test_lxml.py
@@ -165,7 +165,7 @@ class TestLXMLBuilder(SoupTest):
# Both XML and HTML entities are converted to Unicode characters
# during parsing.
text = "<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>"
- expected = u"<p><<sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!>></p>"
+ expected = u"<p>&lt;&lt;sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!&gt;&gt;</p>"
self.assertSoupEquals(text, expected)
def test_smart_quotes_converted_on_the_way_in(self):