summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/beautifulsoup/tests/helpers.py11
-rw-r--r--src/beautifulsoup/tests/test_soup.py2
2 files changed, 11 insertions, 2 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>"
diff --git a/src/beautifulsoup/tests/test_soup.py b/src/beautifulsoup/tests/test_soup.py
index f8d3970..c5b08bb 100644
--- a/src/beautifulsoup/tests/test_soup.py
+++ b/src/beautifulsoup/tests/test_soup.py
@@ -5,6 +5,7 @@ import unittest
from helpers import SoupTest
from beautifulsoup.dammit import UnicodeDammit
+
class TestEncodingConversion(SoupTest):
# Test Beautiful Soup's ability to decode and encode from various
# encodings.
@@ -46,7 +47,6 @@ class TestEncodingConversion(SoupTest):
soup_from_unicode = self.soup(self.unicode_data)
self.assertEquals(soup_from_unicode.encode('utf-8'), self.utf8_data)
-
class TestUnicodeDammit(unittest.TestCase):
"""Standalone tests of Unicode, Dammit."""