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

Method testOnly

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

Source from the content-addressed store, hash-verified

242 self.x = ''.join(x)
243
244 def testOnly(self):
245 strainer = SoupStrainer("b")
246 soup = BeautifulSoup(self.x, parseOnlyThese=strainer)
247 self.assertEquals(len(soup), 15)
248
249 strainer = SoupStrainer(id=re.compile("100.*"))
250 soup = BeautifulSoup(self.x, parseOnlyThese=strainer)
251 self.assertEquals(len(soup), 5)
252
253 strainer = SoupStrainer(text=re.compile("10[01].*"))
254 soup = BeautifulSoup(self.x, parseOnlyThese=strainer)
255 self.assertEquals(len(soup), 10)
256
257 strainer = SoupStrainer(text=lambda(x):x[8]=='3')
258 soup = BeautifulSoup(self.x, parseOnlyThese=strainer)
259 self.assertEquals(len(soup), 3)
260
261class PickleMeThis(SoupTest):
262 "Testing features like pickle and deepcopy."

Callers

nothing calls this directly

Calls 3

BeautifulSoupClass · 0.90
SoupStrainerClass · 0.85
lenFunction · 0.85

Tested by

no test coverage detected