diff options
Diffstat (limited to 'tests/test_libmat2.py')
| -rw-r--r-- | tests/test_libmat2.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 6141dbe..34f7301 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -138,6 +138,37 @@ class TestDeepCleaning(unittest.TestCase): | |||
| 138 | 138 | ||
| 139 | os.remove('./tests/data/clean.odt') | 139 | os.remove('./tests/data/clean.odt') |
| 140 | 140 | ||
| 141 | class TestLightWeightCleaning(unittest.TestCase): | ||
| 142 | def test_pdf(self): | ||
| 143 | shutil.copy('./tests/data/dirty.pdf', './tests/data/clean.pdf') | ||
| 144 | p = pdf.PDFParser('./tests/data/clean.pdf') | ||
| 145 | |||
| 146 | meta = p.get_meta() | ||
| 147 | self.assertEqual(meta['producer'], 'pdfTeX-1.40.14') | ||
| 148 | |||
| 149 | ret = p.remove_all_lightweight() | ||
| 150 | self.assertTrue(ret) | ||
| 151 | |||
| 152 | p = pdf.PDFParser('./tests/data/clean.pdf.cleaned') | ||
| 153 | expected_meta = {'creation-date': -1, 'format': 'PDF-1.5', 'mod-date': -1} | ||
| 154 | self.assertEqual(p.get_meta(), expected_meta) | ||
| 155 | |||
| 156 | os.remove('./tests/data/clean.pdf') | ||
| 157 | |||
| 158 | def test_png(self): | ||
| 159 | shutil.copy('./tests/data/dirty.png', './tests/data/clean.png') | ||
| 160 | p = images.PNGParser('./tests/data/clean.png') | ||
| 161 | |||
| 162 | meta = p.get_meta() | ||
| 163 | self.assertEqual(meta['Comment'], 'This is a comment, be careful!') | ||
| 164 | |||
| 165 | ret = p.remove_all_lightweight() | ||
| 166 | self.assertTrue(ret) | ||
| 167 | |||
| 168 | p = images.PNGParser('./tests/data/clean.png.cleaned') | ||
| 169 | self.assertEqual(p.get_meta(), {}) | ||
| 170 | |||
| 171 | os.remove('./tests/data/clean.png') | ||
| 141 | 172 | ||
| 142 | class TestCleaning(unittest.TestCase): | 173 | class TestCleaning(unittest.TestCase): |
| 143 | def test_pdf(self): | 174 | def test_pdf(self): |
