MCPcopy Index your code
hub / github.com/csev/py4e / test_comment

Method test_comment

code3/bs4/testing.py:202–215  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

200 self.assertEqual("text/javascript", soup.find('script')['type'])
201
202 def test_comment(self):
203 # Comments are represented as Comment objects.
204 markup = "<p>foo<!--foobar-->baz</p>"
205 self.assertSoupEquals(markup)
206
207 soup = self.soup(markup)
208 comment = soup.find(text="foobar")
209 self.assertEqual(comment.__class__, Comment)
210
211 # The comment is properly integrated into the tree.
212 foo = soup.find(text="foo")
213 self.assertEqual(comment, foo.next_element)
214 baz = soup.find(text="baz")
215 self.assertEqual(comment, baz.previous_element)
216
217 def test_preserved_whitespace_in_pre_and_textarea(self):
218 """Whitespace must be preserved in <pre> and <textarea> tags."""

Callers

nothing calls this directly

Calls 3

assertSoupEqualsMethod · 0.45
soupMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected