Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hub
ViralHostRangeDB
Commits
130a626f
Commit
130a626f
authored
Sep 30, 2019
by
Bryan BRANCOTTE
Browse files
Testing mapping without responses
parent
ad03a318
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/viralhostrange/viralhostrangedb/forms.py
View file @
130a626f
...
...
@@ -210,6 +210,10 @@ class RangeMappingForm(forms.Form):
).
fit
(
np
.
array
(
responses
).
reshape
(
-
1
,
1
)).
cluster_centers_
clusters
=
sorted
([
c
[
0
]
for
c
in
clusters
])
except
ModuleNotFoundError
:
# Here when we do not have numpy
pass
except
ValueError
:
# Here when there is no data to work on
pass
for
pos
,
m
in
enumerate
(
models
.
GlobalViralHostResponseValue
.
objects_mappable
().
order_by
(
"value"
)[
1
:],
1
):
...
...
src/viralhostrange/viralhostrangedb/tests/test_views.py
View file @
130a626f
...
...
@@ -2382,6 +2382,18 @@ class DataSourceRangeMappingEditTestCase(ViewTestCase):
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_works_when_empty
(
self
):
self
.
client
.
force_login
(
self
.
user
)
ds
=
models
.
DataSource
.
objects
.
create
(
owner
=
self
.
user
,
public
=
False
,
name
=
"public user"
,
raw_name
=
"ee"
,
kind
=
"FILE"
,
)
url
=
reverse
(
'viralhostrangedb:data-source-mapping-edit'
,
args
=
[
ds
.
pk
])
self
.
assertEqual
(
self
.
client
.
get
(
url
).
status_code
,
200
)
def
test_submit_works
(
self
):
url
=
reverse
(
'viralhostrangedb:data-source-mapping-edit'
,
args
=
[
self
.
public_data_source_of_user
.
pk
])
self
.
client
.
force_login
(
self
.
user
)
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment