Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CiS Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Commits
d2fd9bc9
Commit
d2fd9bc9
authored
3 years ago
by
Malte Schokolowski
Browse files
Options
Downloads
Patches
Plain Diff
added unit tests for export_to_json.py
parent
6d27e4e2
No related branches found
Branches containing commit
No related tags found
1 merge request
!12
bug fixes and updates to code
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
verarbeitung/.gitignore
+5
-1
5 additions, 1 deletion
verarbeitung/.gitignore
verarbeitung/test/construct_graph_unittest.py
+32
-2
32 additions, 2 deletions
verarbeitung/test/construct_graph_unittest.py
with
37 additions
and
3 deletions
verarbeitung/.gitignore
+
5
−
1
View file @
d2fd9bc9
...
...
@@ -58,4 +58,8 @@ target/
#CodeCounter
.VSCodeCounter/
\ No newline at end of file
.VSCodeCounter/
#Json files
*.json
\ No newline at end of file
This diff is collapsed.
Click to expand it.
verarbeitung/test/construct_graph_unittest.py
+
32
−
2
View file @
d2fd9bc9
import
unittest
import
sys
import
sys
sys
.
path
.
append
(
"
../
"
)
from
verarbeitung.construct_new_graph.initialize_graph
import
init_graph_construction
,
initialize_nodes_list_test
,
complete_inner_edges_test
from
verarbeitung.construct_new_graph.add_citations_rec
import
get_cit_type_list
,
create_graph_structure_citations_test
from
verarbeitung.construct_new_graph.export_to_json
import
format_nodes
,
format_edges
from
verarbeitung.test.input_test
import
input_test_func
class
ConstructionTest
(
unittest
.
TestCase
):
...
...
@@ -182,6 +182,36 @@ class ConstructionTest(unittest.TestCase):
self
.
assertCountEqual
(
return_edges
,
[[
'
doi_lg_1_h11
'
,
'
doi_lg_1_i
'
],[
'
doi_lg_1_h12
'
,
'
doi_lg_1_i
'
],[
'
doi_lg_1_i
'
,
'
doi_lg_1_d11
'
]])
self
.
assertCountEqual
(
cit_list
,
[])
## export_to_json.py:
def
test_format_nodes
(
self
):
pub_lg_1_i
=
input_test_func
(
'
doi_lg_1_i
'
)
pub_lg_1_i
.
group
=
0
pub_lg_1_h_11
=
input_test_func
(
'
doi_lg_1_h11
'
)
pub_lg_1_h_11
.
group
=
1
pub_lg_1_d_11
=
input_test_func
(
'
doi_lg_1_d11
'
)
pub_lg_1_d_11
.
group
=
-
1
return_list_of_node_dicts
=
format_nodes
([
pub_lg_1_i
,
pub_lg_1_h_11
,
pub_lg_1_d_11
])
check_list_of_node_dicts
=
[
{
"
doi
"
:
'
doi_lg_1_i
'
,
"
name
"
:
'
title_lg_1_i
'
,
"
author
"
:
[
'
contributor_lg_1_i
'
],
"
year
"
:
'
date_lg_1_i
'
,
"
journal
"
:
'
journal_lg_1_i
'
,
"
group
"
:
'
Input
'
,
"
depth
"
:
0
,
"
citations
"
:
2
},
{
"
doi
"
:
'
doi_lg_1_h11
'
,
"
name
"
:
'
title_lg_1_h11
'
,
"
author
"
:
[
'
contributor_lg_1_h11
'
],
"
year
"
:
'
date_lg_1_h11
'
,
"
journal
"
:
'
journal_lg_1_h11
'
,
"
group
"
:
'
Citedby
'
,
"
depth
"
:
1
,
"
citations
"
:
2
},
{
"
doi
"
:
'
doi_lg_1_d11
'
,
"
name
"
:
'
title_lg_1_d11
'
,
"
author
"
:
[
'
contributor_lg_1_d11
'
],
"
year
"
:
'
date_lg_1_d11
'
,
"
journal
"
:
'
journal_lg_1_d11
'
,
"
group
"
:
'
Reference
'
,
"
depth
"
:
-
1
,
"
citations
"
:
1
}]
self
.
assertCountEqual
(
return_list_of_node_dicts
,
check_list_of_node_dicts
)
def
test_format_edges
(
self
):
return_list_of_edges
=
format_edges
([[
'
doi_lg_1_i
'
,
'
doi_lg_1_d11
'
],[
'
doi_lg_1_i
'
,
'
doi_lg_1_d12
'
],[
'
doi_lg_1_h11
'
,
'
doi_lg_1_i
'
],[
'
doi_lg_1_h12
'
,
'
doi_lg_1_i
'
]])
check_list_of_edges
=
[{
"
source
"
:
'
doi_lg_1_i
'
,
"
target
"
:
'
doi_lg_1_d11
'
},{
"
source
"
:
'
doi_lg_1_i
'
,
"
target
"
:
'
doi_lg_1_d12
'
},
{
"
source
"
:
'
doi_lg_1_h11
'
,
"
target
"
:
'
doi_lg_1_i
'
},{
"
source
"
:
'
doi_lg_1_h12
'
,
"
target
"
:
'
doi_lg_1_i
'
}]
self
.
assertCountEqual
(
return_list_of_edges
,
check_list_of_edges
)
def
keep_only_dois
(
nodes
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment