Commit 2f7e09be authored by Bogdan's avatar Bogdan

Exception Handling for tests 2

parent cba246df
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)
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
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)
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment