diff options
| -rw-r--r-- | tests/test_libmat2.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 19e47aa..571f92d 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -4,6 +4,7 @@ import unittest | |||
| 4 | import shutil | 4 | import shutil |
| 5 | import os | 5 | import os |
| 6 | import re | 6 | import re |
| 7 | import sys | ||
| 7 | import tarfile | 8 | import tarfile |
| 8 | import tempfile | 9 | import tempfile |
| 9 | import zipfile | 10 | import zipfile |
| @@ -638,10 +639,20 @@ class TestCleaning(unittest.TestCase): | |||
| 638 | os.remove('./tests/data/clean.cleaned.html') | 639 | os.remove('./tests/data/clean.cleaned.html') |
| 639 | os.remove('./tests/data/clean.cleaned.cleaned.html') | 640 | os.remove('./tests/data/clean.cleaned.cleaned.html') |
| 640 | 641 | ||
| 641 | with open('./tests/data/clean.html', 'w') as f: | 642 | if sys.version_info >= (3, 13): |
| 642 | f.write('<title><title><pouet/><meta/></title></title><test/>') | 643 | with open('./tests/data/clean.html', 'w') as f: |
| 643 | with self.assertRaises(ValueError): | 644 | f.write('<title><title><pouet/><meta/></title></title><test/>') |
| 645 | with self.assertRaises(ValueError): | ||
| 646 | p = web.HTMLParser('./tests/data/clean.html') | ||
| 647 | else: | ||
| 648 | with open('./tests/data/clean.html', 'w') as f: | ||
| 649 | f.write('<title><title><pouet/><meta/></title></title><test/>') | ||
| 644 | p = web.HTMLParser('./tests/data/clean.html') | 650 | p = web.HTMLParser('./tests/data/clean.html') |
| 651 | self.assertTrue(p.remove_all()) | ||
| 652 | with open('./tests/data/clean.cleaned.html', 'r') as f: | ||
| 653 | self.assertEqual(f.read(), '<title></title><test/>') | ||
| 654 | os.remove('./tests/data/clean.cleaned.html') | ||
| 655 | os.remove('./tests/data/clean.html') | ||
| 645 | 656 | ||
| 646 | with open('./tests/data/clean.html', 'w') as f: | 657 | with open('./tests/data/clean.html', 'w') as f: |
| 647 | f.write('<test><title>Some<b>metadata</b><br/></title></test>') | 658 | f.write('<test><title>Some<b>metadata</b><br/></title></test>') |
