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
8b765dbf
Commit
8b765dbf
authored
5 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Prove that the tar parser is working
parent
b5d586f4
No related branches found
No related tags found
1 merge request
!39
Add tar archive support
Pipeline
#24290
passed
5 years ago
Stage: linting
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_libmat2.py
+16
-0
16 additions, 0 deletions
tests/test_libmat2.py
with
16 additions
and
0 deletions
tests/test_libmat2.py
+
16
−
0
View file @
8b765dbf
...
...
@@ -5,6 +5,7 @@ import shutil
import
os
import
re
import
tarfile
import
tempfile
import
zipfile
from
libmat2
import
pdf
,
images
,
audio
,
office
,
parser_factory
,
torrent
,
harmless
...
...
@@ -733,6 +734,21 @@ class TestCleaning(unittest.TestCase):
self
.
assertEqual
(
p
.
get_meta
(),
{})
self
.
assertTrue
(
p
.
remove_all
())
tmp_dir
=
tempfile
.
mkdtemp
()
with
tarfile
.
open
(
'
./tests/data/dirty.cleaned.tar
'
)
as
zout
:
zout
.
extractall
(
path
=
tmp_dir
)
zout
.
close
()
number_of_files
=
0
for
root
,
_
,
fnames
in
os
.
walk
(
tmp_dir
):
for
f
in
fnames
:
complete_path
=
os
.
path
.
join
(
root
,
f
)
p
,
_
=
parser_factory
.
get_parser
(
complete_path
)
self
.
assertIsNotNone
(
p
)
self
.
assertEqual
(
p
.
get_meta
(),
{})
number_of_files
+=
1
self
.
assertEqual
(
number_of_files
,
3
)
os
.
remove
(
'
./tests/data/dirty.tar
'
)
os
.
remove
(
'
./tests/data/dirty.cleaned.tar
'
)
os
.
remove
(
'
./tests/data/dirty.cleaned.cleaned.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