From fcefebe15290b9ff44934efa73fb07c70ebf5171 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Thu, 23 Feb 2012 12:23:12 -0500 Subject: Fixed handling of the closing of namespaced tags. --- bs4/tests/test_tree.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'bs4/tests/test_tree.py') diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index ce9a7ec..c75b561 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -18,7 +18,13 @@ from bs4.builder import ( builder_registry, HTMLParserTreeBuilder, ) -from bs4.element import CData, NavigableString, SoupStrainer, Tag +from bs4.element import ( + CData, + Doctype, + NavigableString, + SoupStrainer, + Tag, +) from bs4.testing import ( SoupTest, skipIf, @@ -1277,3 +1283,12 @@ class TestNavigableStringSubclasses(SoupTest): self.assertEqual(str(soup), "") self.assertEqual(soup.find(text="foo"), "foo") self.assertEqual(soup.contents[0], "foo") + + def test_doctype_ends_in_newline(self): + # Unlike other NavigableString subclasses, a DOCTYPE always ends + # in a newline. + doctype = Doctype("foo") + soup = self.soup("") + soup.insert(1, doctype) + self.assertEqual(soup.encode(), b"\n") + -- cgit v1.2.3