diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-26 21:26:15 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-26 21:26:15 -0500 |
commit | d7056f49c8bb3a448cec2f1a6f2de55e93c8e8d6 (patch) | |
tree | cc75bdadec0060288b1b76213c3ac2de34d9ab68 /tests/test_tree.py | |
parent | ef5770589595e80cbd9690b64504a2166b3558fd (diff) |
First stab at HTML entity replacement.
Diffstat (limited to 'tests/test_tree.py')
-rw-r--r-- | tests/test_tree.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_tree.py b/tests/test_tree.py index 0b3d72e..249e7ae 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -830,6 +830,19 @@ class TestPersistence(SoupTest): class TestSubstitutions(SoupTest): + def test_entity_substitution(self): + soup = self.soup( + u"<b>Sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!</b>") + encoded = soup.encode("utf-8", replace_with_html_entities=True) + self.assertEquals(encoded, + self.document_for("<b>Sacré bleu!</b>")) + + def test_entity_substitution_off_by_default(self): + markup = u"<b>Sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!</b>" + soup = self.soup(markup) + encoded = soup.b.encode("utf-8") + self.assertEquals(encoded, markup.encode('utf-8')) + def test_encoding_substitution(self): # Here's the <meta> tag saying that a document is # encoded in Shift-JIS. |