summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_libmat2.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py
index 32ae543..d199f54 100644
--- a/tests/test_libmat2.py
+++ b/tests/test_libmat2.py
@@ -874,4 +874,34 @@ class TextDocx(unittest.TestCase):
874 self.assertNotIn('word/comments.xml', zipin.namelist()) 874 self.assertNotIn('word/comments.xml', zipin.namelist())
875 875
876 os.remove('./tests/data/comment_clean.docx') 876 os.remove('./tests/data/comment_clean.docx')
877 os.remove('./tests/data/comment_clean.cleaned.docx')
878
879 def test_comment_references_are_removed(self):
880 with zipfile.ZipFile('./tests/data/comment.docx') as zipin:
881 c = zipin.open('word/document.xml')
882 content = c.read()
883
884 r = b'w:commentRangeStart'
885 self.assertIn(r, content)
886 r = b'w:commentRangeEnd'
887 self.assertIn(r, content)
888 r = b'w:commentReference'
889 self.assertIn(r, content)
890
891 shutil.copy('./tests/data/comment.docx', './tests/data/comment_clean.docx')
892 p = office.MSOfficeParser('./tests/data/comment_clean.docx')
893 self.assertTrue(p.remove_all())
894
895 with zipfile.ZipFile('./tests/data/comment_clean.cleaned.docx') as zipin:
896 c = zipin.open('word/document.xml')
897 content = c.read()
898
899 r = b'w:commentRangeStart'
900 self.assertNotIn(r, content)
901 r = b'w:commentRangeEnd'
902 self.assertNotIn(r, content)
903 r = b'w:commentReference'
904 self.assertNotIn(r, content)
905
906 os.remove('./tests/data/comment_clean.docx')
877 os.remove('./tests/data/comment_clean.cleaned.docx') \ No newline at end of file 907 os.remove('./tests/data/comment_clean.cleaned.docx') \ No newline at end of file