Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
backtranslate
Commits
b6668d61
Commit
b6668d61
authored
Oct 13, 2016
by
Laros
Browse files
Added unit tests for the CLI.
parent
f69f3688
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_cli.py
0 → 100644
View file @
b6668d61
"""
Tests for the backtranslate CLI.
"""
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
from
future.builtins
import
str
,
zip
import
StringIO
import
md5
from
backtranslate
import
cli
def
md5_check
(
data
,
md5sum
):
return
md5
.
md5
(
data
).
hexdigest
()
==
md5sum
class
TestParser
(
object
):
"""
Test the backtranslate.backtranslate module.
"""
def
setup
(
self
):
self
.
_input
=
open
(
'data/mhv.fa'
)
self
.
_output
=
StringIO
.
StringIO
()
def
test_with_dna
(
self
):
cli
.
with_dna
(
self
.
_input
,
self
.
_output
,
210
,
1
,
'Leu'
)
assert
md5_check
(
self
.
_output
.
getvalue
(),
'efd57489b71583751f3a7efdd70df840'
)
def
test_without_dna
(
self
):
cli
.
without_dna
(
self
.
_output
,
92
,
'Asp'
,
'Tyr'
)
assert
md5_check
(
self
.
_output
.
getvalue
(),
'35e17a7e874f11abccb3bd3054c53993'
)
def
test_find_stops
(
self
):
cli
.
find_stops
(
self
.
_input
,
self
.
_output
,
210
,
False
)
assert
md5_check
(
self
.
_output
.
getvalue
(),
'b3dbcc94594ab61e36dbb2256d4b4561'
)
def
test_find_stops_compact
(
self
):
cli
.
find_stops
(
self
.
_input
,
self
.
_output
,
210
,
True
)
assert
md5_check
(
self
.
_output
.
getvalue
(),
'34aa553f2ea72ca992b2568a963c27ee'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment