diff options
| author | jvoisin | 2019-02-08 00:26:47 +0100 |
|---|---|---|
| committer | jvoisin | 2019-02-08 23:05:18 +0100 |
| commit | 6cc034e81bd0cea98dffe4d7311f3bd16178b63e (patch) | |
| tree | 319ec5a697a1a1c49089084c09b0a30cbd4983f7 /tests/test_libmat2.py | |
| parent | e1dd439fc86ba15816e2331e8bed67dd7147e368 (diff) | |
Add support for html files
Diffstat (limited to 'tests/test_libmat2.py')
| -rw-r--r-- | tests/test_libmat2.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 548b076..8753e09 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -6,7 +6,7 @@ import os | |||
| 6 | import zipfile | 6 | import zipfile |
| 7 | 7 | ||
| 8 | from libmat2 import pdf, images, audio, office, parser_factory, torrent, harmless | 8 | from libmat2 import pdf, images, audio, office, parser_factory, torrent, harmless |
| 9 | from libmat2 import check_dependencies, video, archive | 9 | from libmat2 import check_dependencies, video, archive, html |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | class TestCheckDependencies(unittest.TestCase): | 12 | class TestCheckDependencies(unittest.TestCase): |
| @@ -596,3 +596,21 @@ class TestCleaning(unittest.TestCase): | |||
| 596 | os.remove('./tests/data/clean.gif') | 596 | os.remove('./tests/data/clean.gif') |
| 597 | os.remove('./tests/data/clean.cleaned.gif') | 597 | os.remove('./tests/data/clean.cleaned.gif') |
| 598 | os.remove('./tests/data/clean.cleaned.cleaned.gif') | 598 | os.remove('./tests/data/clean.cleaned.cleaned.gif') |
| 599 | |||
| 600 | def test_html(self): | ||
| 601 | shutil.copy('./tests/data/dirty.html', './tests/data/clean.html') | ||
| 602 | p = html.HTMLParser('./tests/data/clean.html') | ||
| 603 | |||
| 604 | meta = p.get_meta() | ||
| 605 | self.assertEqual(meta['author'], 'jvoisin') | ||
| 606 | |||
| 607 | ret = p.remove_all() | ||
| 608 | self.assertTrue(ret) | ||
| 609 | |||
| 610 | p = html.HTMLParser('./tests/data/clean.cleaned.html') | ||
| 611 | self.assertEqual(p.get_meta(), {}) | ||
| 612 | self.assertTrue(p.remove_all()) | ||
| 613 | |||
| 614 | os.remove('./tests/data/clean.html') | ||
| 615 | os.remove('./tests/data/clean.cleaned.html') | ||
| 616 | os.remove('./tests/data/clean.cleaned.cleaned.html') | ||
