Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
iPPIDB
ippidb-web
Commits
5ca15143
Commit
5ca15143
authored
6 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
add tests for utils.FingerPrinter
Former-commit-id: 50b1523399f84d2664b4b1d3e6efa3efbddc2d2c
parent
8c21d2b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ippisite/ippidb/tests.py
+31
-1
31 additions, 1 deletion
ippisite/ippidb/tests.py
with
31 additions
and
1 deletion
ippisite/ippidb/tests.py
+
31
−
1
View file @
5ca15143
from
django.test
import
TestCase
from
django.test
import
TestCase
from
.utils
import
FingerPrinter
from
openbabel
import
vectorUnsignedInt
# Create your tests here.
class
FingerPrinterTestCase
(
TestCase
):
def
setUp
(
self
):
self
.
fingerprinter
=
FingerPrinter
(
"
FP4
"
)
self
.
smiles
=
"
CC
"
self
.
fp
=
vectorUnsignedInt
([
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
])
self
.
smiles_dict
=
{
1
:
"
CC
"
,
2
:
"
CCC
"
}
self
.
fp_dict
=
{
1
:
vectorUnsignedInt
([
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]),
2
:
vectorUnsignedInt
([
3
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
])}
self
.
tanimoto_dict
=
{
1
:
1.0
,
2
:
0.5
}
def
assertEqualVUI
(
self
,
vui_one
,
vui_two
):
return
self
.
assertEqual
(
list
(
vui_one
),
list
(
vui_two
))
def
assertEqualVUIdict
(
self
,
vuidict_one
,
vuidict_two
):
vuidict_one
=
{
id_
:
list
(
vui
)
for
id_
,
vui
in
vuidict_one
.
items
()}
vuidict_two
=
{
id_
:
list
(
vui
)
for
id_
,
vui
in
vuidict_two
.
items
()}
return
self
.
assertEqual
(
vuidict_one
,
vuidict_two
)
def
test_fp
(
self
):
self
.
assertEqualVUI
(
self
.
fingerprinter
.
fp
(
self
.
smiles
),
self
.
fp
)
def
test_fp_dict
(
self
):
self
.
assertEqualVUIdict
(
self
.
fingerprinter
.
fp_dict
(
self
.
smiles_dict
),
self
.
fp_dict
)
def
test_tanimoto_fps
(
self
):
self
.
assertEqual
(
self
.
fingerprinter
.
tanimoto_fps
(
self
.
smiles
,
self
.
fp_dict
),
self
.
tanimoto_dict
)
def
test_tanimoto_smiles
(
self
):
self
.
assertEqual
(
self
.
fingerprinter
.
tanimoto_smiles
(
self
.
smiles
,
self
.
smiles_dict
),
self
.
tanimoto_dict
)
\ No newline at end of file
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