diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_libmat2.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 491f396..7855062 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -931,3 +931,24 @@ class TextDocx(unittest.TestCase): | |||
| 931 | 931 | ||
| 932 | os.remove('./tests/data/comment_clean.docx') | 932 | os.remove('./tests/data/comment_clean.docx') |
| 933 | os.remove('./tests/data/comment_clean.cleaned.docx') | 933 | os.remove('./tests/data/comment_clean.cleaned.docx') |
| 934 | |||
| 935 | def test_clean_document_xml_rels(self): | ||
| 936 | with zipfile.ZipFile('./tests/data/comment.docx') as zipin: | ||
| 937 | c = zipin.open('word/_rels/document.xml.rels') | ||
| 938 | content = c.read() | ||
| 939 | r = b'Target="comments.xml"' | ||
| 940 | self.assertIn(r, content) | ||
| 941 | |||
| 942 | shutil.copy('./tests/data/comment.docx', './tests/data/comment_clean.docx') | ||
| 943 | p = office.MSOfficeParser('./tests/data/comment_clean.docx') | ||
| 944 | self.assertTrue(p.remove_all()) | ||
| 945 | |||
| 946 | with zipfile.ZipFile('./tests/data/comment_clean.cleaned.docx') as zipin: | ||
| 947 | c = zipin.open('word/_rels/document.xml.rels') | ||
| 948 | content = c.read() | ||
| 949 | r = b'Target="comments.xml"' | ||
| 950 | self.assertNotIn(r, content) | ||
| 951 | |||
| 952 | os.remove('./tests/data/comment_clean.docx') | ||
| 953 | os.remove('./tests/data/comment_clean.cleaned.docx') | ||
| 954 | |||
