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
33a0d16a
Commit
33a0d16a
authored
5 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Bump coverage back to 100%
parent
683f8a51
No related branches found
No related tags found
No related merge requests found
Pipeline
#24280
failed
5 years ago
Stage: linting
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_corrupted_files.py
+20
-2
20 additions, 2 deletions
tests/test_corrupted_files.py
with
20 additions
and
2 deletions
tests/test_corrupted_files.py
+
20
−
2
View file @
33a0d16a
...
...
@@ -5,9 +5,10 @@ import shutil
import
os
import
logging
import
zipfile
import
tarfile
from
libmat2
import
pdf
,
images
,
audio
,
office
,
parser_factory
,
torrent
from
libmat2
import
harmless
,
video
,
web
from
libmat2
import
harmless
,
video
,
web
,
archive
# No need to logging messages, should something go wrong,
# the testsuite _will_ fail.
...
...
@@ -278,7 +279,6 @@ class TestCorruptedFiles(unittest.TestCase):
p
.
remove_all
()
os
.
remove
(
'
./tests/data/clean.html
'
)
def
test_epub
(
self
):
with
zipfile
.
ZipFile
(
'
./tests/data/clean.epub
'
,
'
w
'
)
as
zout
:
zout
.
write
(
'
./tests/data/dirty.jpg
'
,
'
OEBPS/content.opf
'
)
...
...
@@ -291,3 +291,21 @@ class TestCorruptedFiles(unittest.TestCase):
self
.
assertFalse
(
p
.
remove_all
())
os
.
remove
(
'
./tests/data/clean.epub
'
)
def
test_tar
(
self
):
with
tarfile
.
TarFile
(
'
./tests/data/clean.tar
'
,
'
w
'
)
as
zout
:
zout
.
add
(
'
./tests/data/dirty.flac
'
)
zout
.
add
(
'
./tests/data/dirty.docx
'
)
zout
.
add
(
'
./tests/data/dirty.jpg
'
)
zout
.
add
(
'
./tests/data/embedded_corrupted.docx
'
)
p
,
mimetype
=
parser_factory
.
get_parser
(
'
./tests/data/clean.tar
'
)
self
.
assertEqual
(
mimetype
,
'
application/x-tar
'
)
meta
=
p
.
get_meta
()
self
.
assertEqual
(
meta
[
'
./tests/data/dirty.flac
'
][
'
comments
'
],
'
Thank you for using MAT !
'
)
self
.
assertEqual
(
meta
[
'
./tests/data/dirty.docx
'
][
'
word/media/image1.png
'
][
'
Comment
'
],
'
This is a comment, be careful!
'
)
self
.
assertFalse
(
p
.
remove_all
())
os
.
remove
(
'
./tests/data/clean.tar
'
)
shutil
.
copy
(
'
./tests/data/dirty.png
'
,
'
./tests/data/clean.tar
'
)
with
self
.
assertRaises
(
ValueError
):
archive
.
TarParser
(
'
./tests/data/clean.tar
'
)
os
.
remove
(
'
./tests/data/clean.tar
'
)
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