summaryrefslogtreecommitdiff
path: root/tests/test_libmat2.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_libmat2.py')
-rw-r--r--tests/test_libmat2.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py
index f4b1890..46e234e 100644
--- a/tests/test_libmat2.py
+++ b/tests/test_libmat2.py
@@ -633,6 +633,33 @@ class TestCleaning(unittest.TestCase):
633 os.remove('./tests/data/clean.cleaned.html') 633 os.remove('./tests/data/clean.cleaned.html')
634 os.remove('./tests/data/clean.cleaned.cleaned.html') 634 os.remove('./tests/data/clean.cleaned.cleaned.html')
635 635
636 with open('./tests/data/clean.html', 'w') as f:
637 f.write('<title><title><pouet/><meta/></title></title><test/>')
638 p = web.HTMLParser('./tests/data/clean.html')
639 self.assertTrue(p.remove_all())
640 with open('./tests/data/clean.cleaned.html', 'r') as f:
641 self.assertEqual(f.read(), '<title></title><test/>')
642 os.remove('./tests/data/clean.html')
643 os.remove('./tests/data/clean.cleaned.html')
644
645 with open('./tests/data/clean.html', 'w') as f:
646 f.write('<test><title>Some<b>metadata</b><br/></title></test>')
647 p = web.HTMLParser('./tests/data/clean.html')
648 self.assertTrue(p.remove_all())
649 with open('./tests/data/clean.cleaned.html', 'r') as f:
650 self.assertEqual(f.read(), '<test><title></title></test>')
651 os.remove('./tests/data/clean.html')
652 os.remove('./tests/data/clean.cleaned.html')
653
654 with open('./tests/data/clean.html', 'w') as f:
655 f.write('<meta><meta/></meta>')
656 p = web.HTMLParser('./tests/data/clean.html')
657 self.assertTrue(p.remove_all())
658 with open('./tests/data/clean.cleaned.html', 'r') as f:
659 self.assertEqual(f.read(), '')
660 os.remove('./tests/data/clean.html')
661 os.remove('./tests/data/clean.cleaned.html')
662
636 663
637 def test_epub(self): 664 def test_epub(self):
638 shutil.copy('./tests/data/dirty.epub', './tests/data/clean.epub') 665 shutil.copy('./tests/data/dirty.epub', './tests/data/clean.epub')