Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mat2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jvoisin
mat2
Commits
1b9ce34e
Commit
1b9ce34e
authored
11 months ago
by
Alex Marchant
Browse files
Options
Downloads
Patches
Plain Diff
Add test that checks if comments.xml is removed without errors
parent
17e76ab6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#210471
passed with warnings
11 months ago
Stage: linting
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/data/comment.docx
+0
-0
0 additions, 0 deletions
tests/data/comment.docx
tests/test_libmat2.py
+17
-0
17 additions, 0 deletions
tests/test_libmat2.py
with
17 additions
and
0 deletions
tests/data/comment.docx
0 → 100644
+
0
−
0
View file @
1b9ce34e
File added
This diff is collapsed.
Click to expand it.
tests/test_libmat2.py
+
17
−
0
View file @
1b9ce34e
...
...
@@ -858,3 +858,20 @@ class TestComplexOfficeFiles(unittest.TestCase):
os
.
remove
(
target
)
os
.
remove
(
p
.
output_filename
)
class
TextDocx
(
unittest
.
TestCase
):
def
test_comment_xml_is_removed
(
self
):
with
zipfile
.
ZipFile
(
'
./tests/data/comment.docx
'
)
as
zipin
:
# Check if 'word/comments.xml' exists in the zip
self
.
assertIn
(
'
word/comments.xml
'
,
zipin
.
namelist
())
shutil
.
copy
(
'
./tests/data/comment.docx
'
,
'
./tests/data/comment_clean.docx
'
)
p
=
office
.
MSOfficeParser
(
'
./tests/data/comment_clean.docx
'
)
self
.
assertTrue
(
p
.
remove_all
())
with
zipfile
.
ZipFile
(
'
./tests/data/comment_clean.cleaned.docx
'
)
as
zipin
:
# Check if 'word/comments.xml' exists in the zip
self
.
assertNotIn
(
'
word/comments.xml
'
,
zipin
.
namelist
())
os
.
remove
(
'
./tests/data/comment_clean.docx
'
)
os
.
remove
(
'
./tests/data/comment_clean.cleaned.docx
'
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment