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
2f7e09be
Commit
2f7e09be
authored
Feb 02, 2021
by
Bogdan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exception Handling for tests 2
parent
cba246df
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
568 additions
and
550 deletions
+568
-550
test_cluster.py
...le-stage-discovery-microservice/app/tests/test_cluster.py
+24
-20
test_cluster_result.py
...e-discovery-microservice/app/tests/test_cluster_result.py
+107
-103
test_clusterer.py
...-stage-discovery-microservice/app/tests/test_clusterer.py
+147
-141
test_similarity.py
...stage-discovery-microservice/app/tests/test_similarity.py
+290
-286
No files found.
src/data-hub/role-stage-discovery-microservice/app/tests/test_cluster.py
View file @
2f7e09be
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
]:
try
:
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
]:
sys
.
path
.
insert
(
1
,
path
)
# python -m unittest discover
from
db.entities
import
Cluster
# python -m unittest discover
from
db.entities
import
Cluster
from
datetime
import
date
,
datetime
import
json
from
datetime
import
date
,
datetime
import
json
class
TestCluster
(
unittest
.
TestCase
):
class
TestCluster
(
unittest
.
TestCase
):
def
test_init_Cluster
(
self
):
try
:
c
=
Cluster
(
'debug'
,
'debug-table1'
,
'layer1'
,
1
,
[
1
,
2
,
3
])
...
...
@@ -22,5 +23,8 @@ class TestCluster(unittest.TestCase):
except
Exception
as
e
:
print
(
e
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
except
Exception
as
e
:
print
(
"Exception found:"
)
print
(
e
)
src/data-hub/role-stage-discovery-microservice/app/tests/test_cluster_result.py
View file @
2f7e09be
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
]:
try
:
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
]:
sys
.
path
.
insert
(
1
,
path
)
# python -m unittest discover
from
processing.clustering
import
ClusterResultConverter
,
ClusterResult
from
typing
import
List
,
Dict
,
Any
# python -m unittest discover
from
processing.clustering
import
ClusterResultConverter
,
ClusterResult
from
typing
import
List
,
Dict
,
Any
class
TestClusterResult
(
unittest
.
TestCase
):
class
TestClusterResult
(
unittest
.
TestCase
):
converter
:
ClusterResultConverter
=
None
def
setUp
(
self
):
...
...
@@ -99,5 +100,8 @@ class TestClusterResult(unittest.TestCase):
}
#endregion helper methods
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
except
Exception
as
e
:
print
(
"Exception found:"
)
print
(
e
)
\ No newline at end of file
src/data-hub/role-stage-discovery-microservice/app/tests/test_clusterer.py
View file @
2f7e09be
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
]:
try
:
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
]:
sys
.
path
.
insert
(
1
,
path
)
# python -m unittest discover
from
processing.clustering
import
Clusterer
,
ClusterResult
import
numpy
as
np
from
typing
import
List
,
Dict
,
Any
class
TestClusterer
(
unittest
.
TestCase
):
# python -m unittest discover
from
processing.clustering
import
Clusterer
,
ClusterResult
import
numpy
as
np
from
typing
import
List
,
Dict
,
Any
class
TestClusterer
(
unittest
.
TestCase
):
clusterer
:
Clusterer
=
None
def
setUp
(
self
):
...
...
@@ -190,5 +193,8 @@ class TestClusterer(unittest.TestCase):
#endregion helper methods
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
except
Exception
as
e
:
print
(
"Exception found:"
)
print
(
e
)
src/data-hub/role-stage-discovery-microservice/app/tests/test_similarity.py
View file @
2f7e09be
import
unittest
try
:
import
unittest
import
sys
for
path
in
[
'../'
,
'./'
,
'../../../modules/'
,
'../../../../modules'
]:
import
sys
for
path
in
[
'../'
,
'./'
,
'../../../modules/'
,
'../../../../modules'
]:
sys
.
path
.
insert
(
1
,
path
)
from
db.entities.connected_node
import
NodeC
from
db.entities.connected_cluster
import
ClusterC
from
db.entities.connected_layer
import
LayerC
from
db.entities.connected_node
import
NodeC
from
db.entities.connected_cluster
import
ClusterC
from
db.entities.connected_layer
import
LayerC
import
math
import
datetime
from
typing
import
Dict
from
typing
import
Dict
from
processing.similarityFiles.dataInput
import
*
from
processing.similarityFiles.calculateWeights
import
*
from
processing.similarityFiles.calculateSimilarity
import
*
from
processing.similarityFiles.miscFunctions
import
*
import
math
import
datetime
from
typing
import
Dict
from
typing
import
Dict
from
processing.similarityFiles.dataInput
import
*
from
processing.similarityFiles.calculateWeights
import
*
from
processing.similarityFiles.calculateSimilarity
import
*
from
processing.similarityFiles.miscFunctions
import
*
import
json
import
json
class
TestSimilarity
(
unittest
.
TestCase
):
class
TestSimilarity
(
unittest
.
TestCase
):
'''Tests the similarity calculation which works without object orientation.'''
def
test_integration_similarityCalculation
(
self
):
...
...
@@ -67,7 +68,7 @@ class TestSimilarity(unittest.TestCase):
def
getTestLocationLayerData
():
def
getTestLocationLayerData
():
inputLayerLocation
=
[
{
"cluster_label"
:
1
,
...
...
@@ -198,7 +199,7 @@ def getTestLocationLayerData():
]
return
inputLayerLocation
def
getTestTimeLayerData
():
def
getTestTimeLayerData
():
inputLayerTime
=
[
{
"cluster_label"
:
4
,
...
...
@@ -297,7 +298,7 @@ def getTestTimeLayerData():
]
return
inputLayerTime
def
getTestPriceLayerData
():
def
getTestPriceLayerData
():
inputLayerPrice
=
[
{
"cluster_label"
:
6
,
...
...
@@ -397,5 +398,8 @@ def getTestPriceLayerData():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
except
Exception
as
e
:
print
(
"Exception found:"
)
print
(
e
)
\ No newline at end of file
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