MCPcopy Create free account
hub / github.com/clips/pattern / testTextNavigation

Method testTextNavigation

pattern/web/soup/BeautifulSoupTests.py:170–177  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

168 self.assertEquals(len(b.findPreviousSiblings(tag, id=1)), 1)
169
170 def testTextNavigation(self):
171 soup = BeautifulSoup('Foo<b>Bar</b><i id="1"><b>Baz<br />Blee<hr id="1"/></b></i>Blargh')
172 baz = soup.find(text='Baz')
173 self.assertEquals(baz.findParent("i")['id'], '1')
174 self.assertEquals(baz.findNext(text='Blee'), 'Blee')
175 self.assertEquals(baz.findNextSibling(text='Blee'), 'Blee')
176 self.assertEquals(baz.findNextSibling(text='Blargh'), None)
177 self.assertEquals(baz.findNextSibling('hr')['id'], '1')
178
179class SiblingRivalry(SoupTest):
180 "Tests the nextSibling and previousSibling navigation."

Callers

nothing calls this directly

Calls 5

BeautifulSoupClass · 0.90
findParentMethod · 0.80
findNextMethod · 0.80
findNextSiblingMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected