Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soitool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
bachelor-paa-bittet
soitool
Commits
165427c0
Commit
165427c0
authored
5 years ago
by
morkolai
Browse files
Options
Downloads
Patches
Plain Diff
#69 endret navn til original_json
parent
e695de57
No related branches found
No related tags found
1 merge request
!38
#69 Komprimering og dekomprimering
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_compressor.py
+5
-5
5 additions, 5 deletions
test/test_compressor.py
with
5 additions
and
5 deletions
test/test_compressor.py
+
5
−
5
View file @
165427c0
...
...
@@ -11,11 +11,11 @@ class CompressorTest(unittest.TestCase):
def
setUp
(
self
):
"""
Load a json to use as testdata.
"""
with
open
(
"
soitool/testdata/codebook.json
"
,
"
r
"
)
as
file
:
self
.
soi
=
json
.
load
(
file
)
self
.
original
=
json
.
load
(
file
)
def
test_compress
(
self
):
"""
Test compression returns ascii and reduces size.
"""
compressed
=
compress
(
self
.
soi
)
compressed
=
compress
(
self
.
original
)
# Test if compressed is ascii
def
is_ascii
(
string
):
...
...
@@ -25,14 +25,14 @@ class CompressorTest(unittest.TestCase):
self
.
assertTrue
(
is_ascii
(
compressed
))
# Test if size is reduced
smaller
=
len
(
compressed
)
<
len
(
str
(
self
.
soi
))
smaller
=
len
(
compressed
)
<
len
(
str
(
self
.
original
))
self
.
assertTrue
(
smaller
)
def
test_decompress
(
self
):
"""
Test decompression returns same as original.
"""
compressed
=
compress
(
self
.
soi
)
compressed
=
compress
(
self
.
original
)
decompressed
=
decompress
(
compressed
)
self
.
assertEqual
(
decompressed
,
self
.
soi
)
self
.
assertEqual
(
decompressed
,
self
.
original
)
if
__name__
==
"
__main__
"
:
...
...
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