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
SOaAS
dbxref
Commits
23ecd330
Commit
23ecd330
authored
Feb 04, 2020
by
jkeller
Browse files
Delete test_kegg.py
parent
0b4db0ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_kegg.py
deleted
100644 → 0
View file @
0b4db0ed
import
unittest
from
dbxref.retrieve
import
kegg
class
TestKegg
(
unittest
.
TestCase
):
# Test if kegg retriever gives any output
def
test_output
(
self
):
documents
=
kegg
.
retrieve
([{
"db"
:
"KEGG"
,
"id"
:
"K00121"
}],
basics
=
True
,
brite
=
True
,
pathway
=
True
,
dbxrefs_links
=
True
,
formula
=
True
,
reaction
=
True
,
genes
=
True
,
motif
=
True
,
orthology
=
True
,
reference
=
True
)
self
.
assertTrue
(
documents
)
# Test parsing and saving of a graph(v,e) in an adjacency list.
def
test_brite_output
(
self
):
# Tree with one root and one continuous branch
brite_example_1
=
[[
"BRITE Root1"
],
[
" branch1"
],
[
" branch2"
],
[
" Branch3"
],
[
" BRANCH4"
],
[
" branch5"
]
]
brite_example_output_1
=
{
"vertices"
:
[
"Root1"
,
"branch1"
,
"branch2"
,
"Branch3"
,
"BRANCH4"
,
"branch5"
],
"edges"
:
{
"0"
:
[
"1"
],
"1"
:
[
"2"
],
"2"
:
[
"3"
],
"3"
:
[
"4"
],
"4"
:
[
"5"
],
"5"
:
[]
}
}
self
.
assertEqual
(
kegg
.
read_brite
(
brite_example_1
),
brite_example_output_1
)
# Tree with one root but two branches.
brite_example_2
=
[[
"BRITE Root1"
],
[
" branch1"
],
[
" branch2"
],
[
" Branch3"
],
[
" BRANCH4"
],
[
" branch5"
]
]
brite_example_output_2
=
{
"vertices"
:
[
"Root1"
,
"branch1"
,
"branch2"
,
"Branch3"
,
"BRANCH4"
,
"branch5"
],
"edges"
:
{
"0"
:
[
"1"
,
"3"
],
"1"
:
[
"2"
],
"2"
:
[],
"3"
:
[
"4"
],
"4"
:
[
"5"
],
"5"
:
[]
}
}
self
.
assertEqual
(
kegg
.
read_brite
(
brite_example_2
),
brite_example_output_2
)
# Tree with a second root and separate branches
brite_example_3
=
[[
"BRITE Root1"
],
[
" branch1"
],
[
" branch2"
],
[
" Root2"
],
[
" BRANCH4"
],
[
" branch5"
]
]
brite_example_output_3
=
{
"vertices"
:
[
"Root1"
,
"branch1"
,
"branch2"
,
"Root2"
,
"BRANCH4"
,
"branch5"
],
"edges"
:
{
"0"
:
[
"1"
],
"1"
:
[
"2"
],
"2"
:
[],
"3"
:
[
"4"
],
"4"
:
[
"5"
],
"5"
:
[]
}
}
self
.
assertEqual
(
kegg
.
read_brite
(
brite_example_3
),
brite_example_output_3
)
# Tree with one root and branch, bu multiple leafs
brite_example_4
=
[[
"BRITE Root1"
],
[
" branch1"
],
[
" branch2"
],
[
" Branch3"
],
[
" BRANCH4"
],
[
" branch5"
]
]
brite_example_output_4
=
{
"vertices"
:
[
"Root1"
,
"branch1"
,
"branch2"
,
"Branch3"
,
"BRANCH4"
,
"branch5"
],
"edges"
:
{
"0"
:
[
"1"
],
"1"
:
[
"2"
,
"3"
,
"4"
,
"5"
],
"2"
:
[],
"3"
:
[],
"4"
:
[],
"5"
:
[]
}
}
self
.
assertEqual
(
kegg
.
read_brite
(
brite_example_4
),
brite_example_output_4
)
# Tree with a mix of above testing methods
brite_example_5
=
[[
"BRITE Root1"
],
[
" branch1"
],
[
" branch2"
],
[
" Branch3"
],
[
" BRANCH4"
],
[
" branch5"
],
[
" Branch6"
],
[
" Branch7"
],
[
" Branch8"
],
[
" Branch9"
]
]
brite_example_output_5
=
{
"vertices"
:
[
"Root1"
,
"branch1"
,
"branch2"
,
"Branch3"
,
"BRANCH4"
,
"branch5"
,
"Branch6"
,
"Branch7"
,
"Branch8"
,
"Branch9"
],
"edges"
:
{
"0"
:
[
"1"
],
"1"
:
[
"2"
,
"8"
],
"2"
:
[
"3"
],
"3"
:
[
"4"
,
"6"
,
"7"
],
"4"
:
[
"5"
],
"5"
:
[],
"6"
:
[],
"7"
:
[],
"8"
:
[
"9"
],
"9"
:
[]
}
}
self
.
assertEqual
(
kegg
.
read_brite
(
brite_example_5
),
brite_example_output_5
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Supports
Markdown
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