diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2010-12-29 19:00:46 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2010-12-29 19:00:46 -0500 |
commit | 484284c0c80aa749ee3050a3194d7bc99cf2916b (patch) | |
tree | 0340301efd77fa122f14a14736ec096524817917 /src/beautifulsoup/tests/helpers.py | |
parent | 3e79613458960499d2bce45d4db0d0e96d8e2ffe (diff) |
Moved in a test for comments (not supported by the html5lib treebuilder yet.
Diffstat (limited to 'src/beautifulsoup/tests/helpers.py')
-rw-r--r-- | src/beautifulsoup/tests/helpers.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/beautifulsoup/tests/helpers.py b/src/beautifulsoup/tests/helpers.py index c62bb48..c8189e3 100644 --- a/src/beautifulsoup/tests/helpers.py +++ b/src/beautifulsoup/tests/helpers.py @@ -2,7 +2,7 @@ import unittest from beautifulsoup import BeautifulSoup -from beautifulsoup.element import SoupStrainer +from beautifulsoup.element import Comment, SoupStrainer from beautifulsoup.builder.lxml_builder import LXMLTreeBuilder class SoupTest(unittest.TestCase): @@ -63,6 +63,15 @@ class BuilderSmokeTest(SoupTest): self.assertSoupEquals( "<p>Foo<br/>bar</p>", "<p>Foo<br />bar</p>") + def test_comment(self): + # Comments are represented as Comment objects. + markup = "<p>foo<!--foobar-->baz</p>" + self.assertSoupEquals(markup) + + soup = self.soup(markup) + comment = soup.find(text="foobar") + self.assertEquals(comment.__class__, Comment) + def test_nested_inline_elements(self): # Inline tags can be nested indefinitely. b_tag = "<b>Inside a B tag</b>" |