Beispiel #1
0
 def test_strip_kill_strong4(self):
     """Test applying a ``Cleaner`` instance that kills strong tags."""
     cleaner = Cleaner(
         strip_xpath='.//*',
         kill_xpath=
         './/script | .//style | .//comment() | .//processing-instruction() | .//strong'
     )
     tree = html.fromstring(HTML4)
     cleaner(tree)
     self.assertEqual(STRIPKS4, tostring(tree).decode())
Beispiel #2
0
 def test_strip_leave_whitespace4(self):
     """Test applying a ``Cleaner`` instance with ``fix_whitespace=False``."""
     cleaner = Cleaner(fix_whitespace=False, strip_xpath='.//*')
     tree = html.fromstring(HTML4)
     cleaner(tree)
     self.assertEqual(STRIPWS4, tostring(tree).decode())