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
cfa062b9
Commit
cfa062b9
authored
Sep 01, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partially fixed tests
parent
b2381df0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
80 deletions
+11
-80
manage_sys_paths.py
...mantic-linking-microservice/app/tests/manage_sys_paths.py
+1
-1
test_HyperGraph.py
...emantic-linking-microservice/app/tests/test_HyperGraph.py
+0
-69
test_pipeline.py
.../semantic-linking-microservice/app/tests/test_pipeline.py
+1
-8
manage_sys_paths.py
...business-logic-microservice/app/tests/manage_sys_paths.py
+7
-0
test_layer_adapter.py
...siness-logic-microservice/app/tests/test_layer_adapter.py
+2
-2
No files found.
src/data-hub/semantic-linking-microservice/app/tests/manage_sys_paths.py
View file @
cfa062b9
# add modules folder to interpreter path
# add modules folder to interpreter path
import
sys
import
sys
import
os
import
os
modules_paths
=
[
'.
./'
,
'../
../../../modules/'
]
modules_paths
=
[
'.
/'
,
'../'
,
'../../../../modules/'
,
'
../../../modules/'
]
for
path
in
modules_paths
:
for
path
in
modules_paths
:
if
os
.
path
.
exists
(
path
):
if
os
.
path
.
exists
(
path
):
sys
.
path
.
insert
(
1
,
path
)
sys
.
path
.
insert
(
1
,
path
)
src/data-hub/semantic-linking-microservice/app/tests/test_HyperGraph.py
deleted
100644 → 0
View file @
b2381df0
import
unittest
import
manage_sys_paths
import
json
from
initialdemo.HyperGraph
import
HyperGraph
class
Test_HyperGraph
(
unittest
.
TestCase
):
hypergraph
:
HyperGraph
=
None
def
setUp
(
self
):
self
.
hypergraph
=
HyperGraph
()
def
test_removeDuplicates_noDupOrdered_sameContent
(
self
):
list_
=
[[
1
,
2
,
3
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
(
list_
,
set_
)
def
test_removeDuplicates_oneDupOrdered_removed
(
self
):
list_
=
[[
1
,
2
,
3
,
3
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
,
3
]],
set_
)
def
test_removeDuplicates_multDupOrdered_allRemoved
(
self
):
list_
=
[[
1
,
1
,
2
,
3
,
3
,
4
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
,
3
,
4
]],
set_
)
def
test_removeDuplicates_noDupUnordered_sameContent
(
self
):
list_
=
[[
1
,
2
,
3
,
5
,
9
,
4
,
30
,
15
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
(
list_
,
set_
)
def
test_removeDuplicates_oneDupUnordered_removed
(
self
):
list_
=
[[
1
,
2
,
3
,
5
,
9
,
4
,
30
,
5
,
15
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
,
3
,
5
,
9
,
4
,
30
,
15
]],
set_
)
def
test_removeDuplicates_multDupUnordered_allRemoved
(
self
):
list_
=
[[
1
,
2
,
5
,
3
,
1
,
70
,
25
,
-
1
,
7
,
-
1
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
,
5
,
3
,
70
,
25
,
-
1
,
7
]],
set_
)
def
test_removeDuplicates_oneDupOrderedMultDim_removed
(
self
):
list_
=
[[
1
,
1
,
2
],[
2
,
2
,
3
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
],[
2
,
3
]],
set_
)
def
test_removeDuplicates_multDupOrderedMultDim_allRemoved
(
self
):
list_
=
[[
1
,
1
,
2
,
3
,
3
],[
2
,
2
,
3
,
4
,
4
,
5
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
,
3
],[
2
,
3
,
4
,
5
]],
set_
)
def
test_removeDuplicates_multDupUnorderedMultDim_allRemoved
(
self
):
list_
=
[[
1
,
2
,
5
,
2
,
7
,
3
],[
-
10
,
5
,
3
,
20
,
-
10
,
-
7
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
,
5
,
7
,
3
],[
-
10
,
5
,
3
,
20
,
-
7
]],
set_
)
def
test_removeDuplicates_multDupUnorderedMultDim2_allRemoved
(
self
):
list_
=
[[
1
,
2
,
5
,
2
,
7
,
3
],[
-
10
,
5
,
3
,
20
,
-
10
,
-
7
],[
1
,
2
]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
([[
1
,
2
,
5
,
7
,
3
],[
-
10
,
5
,
3
,
20
,
-
7
],[
1
,
2
]],
set_
)
def
test_removeDuplicates_multDupUnorderedTripleDim_noDupRemoved
(
self
):
list_
=
[[[
1
,
2
,
5
,
2
,
7
,
3
],[
-
10
,
5
,
3
,
20
,
-
10
,
-
7
],[
1
,
2
]]]
set_
=
self
.
hypergraph
.
remove_duplicates
(
list_
)
self
.
assertEqual
(
list_
,
set_
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
src/data-hub/semantic-linking-microservice/app/tests/test_pipeline.py
View file @
cfa062b9
import
sys
import
os
modules_path
=
'../../../modules/'
if
os
.
path
.
exists
(
modules_path
):
sys
.
path
.
insert
(
1
,
modules_path
)
import
unittest
import
unittest
import
manage_sys_paths
import
manage_sys_paths
import
json
import
json
...
@@ -17,7 +11,7 @@ class DummyMongoRepo:
...
@@ -17,7 +11,7 @@ class DummyMongoRepo:
def
insert_trace
(
self
,
trace
):
def
insert_trace
(
self
,
trace
):
self
.
last_trace
=
trace
self
.
last_trace
=
trace
class
Test_
HyperGraph
(
unittest
.
TestCase
):
class
Test_
Pipeline
(
unittest
.
TestCase
):
handler
=
None
handler
=
None
repo
=
None
repo
=
None
msg_sender
=
None
msg_sender
=
None
...
@@ -45,7 +39,6 @@ class Test_HyperGraph(unittest.TestCase):
...
@@ -45,7 +39,6 @@ class Test_HyperGraph(unittest.TestCase):
}
}
def
testTraceProcessing
(
self
):
def
testTraceProcessing
(
self
):
print
(
"START"
)
msg
=
self
.
_buildTraceMessage
()
msg
=
self
.
_buildTraceMessage
()
self
.
handler
.
handle_new_trace
(
msg
[
"content"
])
self
.
handler
.
handle_new_trace
(
msg
[
"content"
])
...
...
src/participation-hub/business-logic-microservice/app/tests/manage_sys_paths.py
0 → 100644
View file @
cfa062b9
# add modules folder to interpreter path
import
sys
import
os
modules_paths
=
[
'./'
,
'../'
,
'../../../modules/'
]
for
path
in
modules_paths
:
if
os
.
path
.
exists
(
path
):
sys
.
path
.
insert
(
1
,
path
)
src/participation-hub/business-logic-microservice/app/tests/
layer_adapter_test
.py
→
src/participation-hub/business-logic-microservice/app/tests/
test_layer_adapter
.py
View file @
cfa062b9
import
unittest
import
unittest
# import manage_sys_paths
from
db.entities.layer_adapter
import
LayerAdapter
from
db.entities.layer_adapter
import
LayerAdapter
class
Layer_Adapter_Test
(
unittest
.
TestCase
):
class
Test_Layer_Adapter
(
unittest
.
TestCase
):
def
test_valid_adapter
(
self
):
def
test_valid_adapter
(
self
):
adapter1
=
LayerAdapter
(
"layer1"
,
{
"a"
:
"b"
,
"c"
:
"d"
},
[
"a"
])
adapter1
=
LayerAdapter
(
"layer1"
,
{
"a"
:
"b"
,
"c"
:
"d"
},
[
"a"
])
print
(
adapter1
.
to_serializable_dict
)
print
(
adapter1
.
to_serializable_dict
)
...
...
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