Esempio n. 1
0
 def test_tidy_html_with_beautifulsoup(self):
     """htmlutils - Tidying up HTML with BeautifulSoup"""
     res1 = tidy_html(self.html_buffer_1, 'beautifulsoup')
     res2 = tidy_html(self.html_buffer_2, 'beautifulsoup')
     res3 = tidy_html(self.html_buffer_3, 'beautifulsoup')
     self.assertEqual(res1.replace('\n', '').replace(' ', ''),
                     'test')
     self.assertEqual(res2.replace('\n', '').replace(' ', ''),
                     '<blockquote>test<div>test2</div></blockquote>')
     self.assertEqual(res3.replace('\n', '').replace(' ', ''),
                     '<ul><li><ul><li><ahref="rememberwhenb.html">Next</a></li><li><ahref="daysofourlives.html">Back</a></li><li><ahref="newstuff.html">NewStuff</a></li></ul></li></ul><ul><li>Mergeadjacentlists</li></ul><ul><ul><li><ahref="one.html">One</a></li><li><ahref="two.html">Two</a></li><li><ahref="three.html">Three</a></li></ul></ul>')
Esempio n. 2
0
 def test_tidy_html_with_unknown_lib(self):
     """htmlutils - Tidying up HTML with non existing library"""
     res = tidy_html(self.html_buffer_1, 'foo')
     self.assertEqual(res.replace('\n', '').replace(' ', ''),
                      self.html_buffer_1.replace('\n', '').replace(' ', ''))