Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
metagenedb
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Metagenomics
metagenedb
Commits
f4593166
Commit
f4593166
authored
5 years ago
by
Kenzo-Hugo Hillion
Browse files
Options
Downloads
Patches
Plain Diff
fix test for hierarchy
parent
8e08ff30
No related branches found
Branches containing commit
No related tags found
2 merge requests
!59
Prod
,
!16
Add endpoint to generate hierarchy of taxonomy from the backend
Pipeline
#17555
passed with stages
in 2 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/metagenedb/apps/catalog/models/test_taxonomy.py
+13
-13
13 additions, 13 deletions
backend/metagenedb/apps/catalog/models/test_taxonomy.py
with
13 additions
and
13 deletions
backend/metagenedb/apps/catalog/models/test_taxonomy.py
+
13
−
13
View file @
f4593166
from
unit
test
import
TestCase
from
rest_framework.
test
import
API
TestCase
from
.taxonom
y
import
Taxonomy
from
metagenedb.apps.catalog.factor
y
import
Taxonomy
Factory
class
TestBuildHierarchy
(
TestCase
):
class
TestBuildHierarchy
(
API
TestCase
):
@classmethod
def
setUpClass
(
cls
):
def
setUp
(
self
):
"""
Build some test data for different tests
"""
cls
.
root
=
Taxonomy
(
self
.
root
=
Taxonomy
Factory
.
create
(
tax_id
=
"
1
"
,
name
=
"
root
"
,
rank
=
"
no_rank
"
,
)
cls
.
kingdom
=
Taxonomy
(
self
.
kingdom
=
Taxonomy
Factory
(
tax_id
=
"
2
"
,
name
=
"
KINGDOM
"
,
rank
=
"
kingdom
"
,
parent
=
cls
.
root
parent
=
self
.
root
)
cls
.
phylum
=
Taxonomy
(
self
.
phylum
=
Taxonomy
Factory
(
tax_id
=
"
3
"
,
name
=
"
PHYLUM
"
,
rank
=
"
phylum
"
,
parent
=
cls
.
kingdom
parent
=
self
.
kingdom
)
def
test_build_hierarchy
(
self
):
expected_dict
=
{
'
tax_id
'
:
'
3
'
,
'
phylum
'
:
'
3
'
,
'
kingdom
'
:
'
2
'
'
phylum
'
:
self
.
phylum
,
'
kingdom
'
:
self
.
kingdom
}
self
.
assertNotEqual
(
getattr
(
self
.
phylum
,
'
kingdom
'
,
None
),
self
.
kingdom
)
test_dict
=
self
.
phylum
.
build_parental_hierarchy
()
self
.
assertDictEqual
(
test_dict
,
expected_dict
)
self
.
assertEqual
(
getattr
(
self
.
phylum
,
'
kingdom
'
,
None
),
self
.
kingdom
)
This diff is collapsed.
Click to expand it.
Preview
0%
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