diff options
Diffstat (limited to 'tests/test_libmat2.py')
| -rw-r--r-- | tests/test_libmat2.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 0435113..491f396 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -900,4 +900,34 @@ class TextDocx(unittest.TestCase): | |||
| 900 | self.assertIsNotNone(match) | 900 | self.assertIsNotNone(match) |
| 901 | 901 | ||
| 902 | os.remove('./tests/data/comment_clean.docx') | 902 | os.remove('./tests/data/comment_clean.docx') |
| 903 | os.remove('./tests/data/comment_clean.cleaned.docx') \ No newline at end of file | 903 | os.remove('./tests/data/comment_clean.cleaned.docx') |
| 904 | |||
| 905 | def test_comment_references_are_removed(self): | ||
| 906 | with zipfile.ZipFile('./tests/data/comment.docx') as zipin: | ||
| 907 | c = zipin.open('word/document.xml') | ||
| 908 | content = c.read() | ||
| 909 | |||
| 910 | r = b'w:commentRangeStart' | ||
| 911 | self.assertIn(r, content) | ||
| 912 | r = b'w:commentRangeEnd' | ||
| 913 | self.assertIn(r, content) | ||
| 914 | r = b'w:commentReference' | ||
| 915 | self.assertIn(r, content) | ||
| 916 | |||
| 917 | shutil.copy('./tests/data/comment.docx', './tests/data/comment_clean.docx') | ||
| 918 | p = office.MSOfficeParser('./tests/data/comment_clean.docx') | ||
| 919 | self.assertTrue(p.remove_all()) | ||
| 920 | |||
| 921 | with zipfile.ZipFile('./tests/data/comment_clean.cleaned.docx') as zipin: | ||
| 922 | c = zipin.open('word/document.xml') | ||
| 923 | content = c.read() | ||
| 924 | |||
| 925 | r = b'w:commentRangeStart' | ||
| 926 | self.assertNotIn(r, content) | ||
| 927 | r = b'w:commentRangeEnd' | ||
| 928 | self.assertNotIn(r, content) | ||
| 929 | r = b'w:commentReference' | ||
| 930 | self.assertNotIn(r, content) | ||
| 931 | |||
| 932 | os.remove('./tests/data/comment_clean.docx') | ||
| 933 | os.remove('./tests/data/comment_clean.cleaned.docx') | ||
