Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
a31e702c
Commit
a31e702c
authored
Jul 27, 2021
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit tests
parent
b7097db8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
636 additions
and
0 deletions
+636
-0
test_ClusterMetricsCalculator.py
...n-microservice/app/tests/test_ClusterMetricsCalculator.py
+37
-0
test_cluster.py
...ommunity-detection-microservice/app/tests/test_cluster.py
+331
-0
test_layer.py
...-community-detection-microservice/app/tests/test_layer.py
+268
-0
No files found.
src/data-hub/proactive-community-detection-microservice/app/tests/test_ClusterMetricsCalculator.py
0 → 100644
View file @
a31e702c
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
]:
sys
.
path
.
insert
(
1
,
path
)
# python -m unittest discover
from
processing
import
ClusterMetricsCalculator2D
class
TestClusterMetricsCalculator
(
unittest
.
TestCase
):
def
test__get_standard_deviation__same_points_many_decimals__zero_and_not_nan
(
self
):
nodes
=
[{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
},
{
'f1'
:
-
8.58564
,
'f2'
:
41.148567
}]
calc
=
ClusterMetricsCalculator2D
(
nodes
,
[
'f1'
,
'f2'
],
len
(
nodes
),
1
)
self
.
assertAlmostEqual
(
0
,
calc
.
get_standard_deviation
())
def
test__get_range__almost_linear_distribution_in_2d__euclidean_distance
(
self
):
l
=
[(
-
8.657802
,
41.160978
),
(
-
8.65782
,
41.160969
),
(
-
8.657838
,
41.16096
)]
nodes
=
[{
'f1'
:
e
[
0
],
'f2'
:
e
[
1
]}
for
e
in
l
]
calc
=
ClusterMetricsCalculator2D
(
nodes
,
[
'f1'
,
'f2'
],
len
(
nodes
),
1
)
# https://www.calculatorsoup.com/calculators/geometry-plane/distance-two-points.php
self
.
assertAlmostEqual
(
4.0E-5
,
calc
.
get_range
(),
5
)
if
__name__
==
'__main__'
:
unittest
.
main
()
src/data-hub/proactive-community-detection-microservice/app/tests/test_cluster.py
0 → 100644
View file @
a31e702c
This diff is collapsed.
Click to expand it.
src/data-hub/proactive-community-detection-microservice/app/tests/test_layer.py
0 → 100644
View file @
a31e702c
This diff is collapsed.
Click to expand it.
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