Example #1
0
 def testMatchByType(self):
     # test simple tag
     pattern = "<a></a>"
     _scraper = Scraper(pattern)
     exp = BeautifulSoup(pattern)
     
     # same type
     actual = BeautifulSoup("<a></a>")
     self.assertTrue(_scraper.matchByType(exp.contents[0], actual.contents[0]))
     
     # different type
     actual = BeautifulSoup("text")
     self.assertFalse(_scraper.matchByType(exp.contents[0], actual.contents[0]))