Skip to content
Snippets Groups Projects
Commit 159c3ae4 authored by Malte Schokolowski's avatar Malte Schokolowski
Browse files

bug fixes from desktop

parent 02103a68
Branches
No related tags found
1 merge request!12bug fixes and updates to code
...@@ -2,9 +2,10 @@ import unittest ...@@ -2,9 +2,10 @@ import unittest
import sys import sys
from pathlib import Path from pathlib import Path
sys.path.append("../") sys.path.append("../")
from verarbeitung.construct_new_graph.initialize_graph import init_graph_construction from verarbeitung.construct_new_graph.initialize_graph import init_graph_construction, initialize_nodes_list
class ConstructionTest(unittest.TestCase): class ConstructionTest(unittest.TestCase):
maxDiff = None maxDiff = None
...@@ -83,6 +84,24 @@ class ConstructionTest(unittest.TestCase): ...@@ -83,6 +84,24 @@ class ConstructionTest(unittest.TestCase):
self.assertCountEqual(edges, [['doi_d02','doi_d1'], ['doi_d1','doi_d2']]) self.assertCountEqual(edges, [['doi_d02','doi_d1'], ['doi_d1','doi_d2']])
## Ab hier die Tests für die einzelnen Funktionen ##
# initialize_graph.py:
def test_initialize_nodes_list(self):
references_pub_obj_list, citations_pub_obj_list = initialize_nodes_list(['doi_lg_1_i','doi_lg_2_i'], 0, 0, True)
doi_references = keep_only_dois(references_pub_obj_list)
doi_citations = keep_only_dois(citations_pub_obj_list)
self.assertCountEqual(doi_references, [])
self.assertCountEqual(doi_citations, [])
references_pub_obj_list, citations_pub_obj_list = initialize_nodes_list(['doi_lg_1_i','doi_lg_2_i'], 1, 1, True)
doi_references = keep_only_dois(references_pub_obj_list)
doi_citations = keep_only_dois(citations_pub_obj_list)
self.assertCountEqual(doi_references, ['doi_lg_1_d11','doi_lg_1_d12','doi_lg_2_d11','doi_lg_2_d12'])
self.assertCountEqual(doi_citations, ['doi_lg_1_h11','doi_lg_1_h12','doi_cg_i','doi_lg_2_h11','doi_lg_2_h12'])
def keep_only_dois(nodes): def keep_only_dois(nodes):
......
...@@ -13,24 +13,24 @@ from verarbeitung.update_graph.update_graph import update_graph ...@@ -13,24 +13,24 @@ from verarbeitung.update_graph.update_graph import update_graph
class UpdatingTest(unittest.TestCase): class UpdatingTest(unittest.TestCase):
maxDiff = None maxDiff = None
# def test_import_from_json(self): def test_import_from_json(self):
# nodes_old, edges_old = init_graph_construction(['doi_lg_1_i'],2,2,True) nodes_old, edges_old = init_graph_construction(['doi_lg_1_i'],2,2,True)
# output_to_json(nodes_old, edges_old, test_var = True) output_to_json(nodes_old, edges_old, test_var = True)
# nodes_new, edges_new = input_from_json('test_output.json') nodes_new, edges_new = input_from_json('test_output.json')
# self.assertCountEqual(nodes_old,nodes_new) self.assertCountEqual(nodes_old,nodes_new)
# self.assertCountEqual(edges_old, edges_new) self.assertCountEqual(edges_old, edges_new)
# def test_deleted_input_dois(self): def test_deleted_input_dois(self):
# nodes_old_single, edges_old_single = init_graph_construction(['doi_lg_1_i'],2,2,True) nodes_old_single, edges_old_single = init_graph_construction(['doi_lg_1_i'],2,2,True)
# nodes_old_both, edges_old_both = init_graph_construction(['doi_lg_1_i','doi_lg_2_i'],2,2,True) nodes_old_both, edges_old_both = init_graph_construction(['doi_lg_1_i','doi_lg_2_i'],2,2,True)
# output_to_json(nodes_old_both, edges_old_both, test_var=True) output_to_json(nodes_old_both, edges_old_both, test_var=True)
# nodes_new_single, edges_new_single = update_graph(['doi_lg_1_i'], 'test_output.json', 2, 2, True) nodes_new_single, edges_new_single = update_graph(['doi_lg_1_i'], 'test_output.json', 2, 2, True)
# self.assertCountEqual(nodes_old_single,nodes_new_single) self.assertCountEqual(nodes_old_single,nodes_new_single)
# self.assertCountEqual(edges_old_single, edges_new_single) self.assertCountEqual(edges_old_single, edges_new_single)
# nodes_old_single, edges_old_single = init_graph_construction(['doi_cg_i'],3,3,True) nodes_old_single, edges_old_single = init_graph_construction(['doi_cg_i'],3,3,True)
# nodes_old_two, edges_old_two = init_graph_construction(['doi_lg_1_i','doi_cg_i'],3,3,True) nodes_old_two, edges_old_two = init_graph_construction(['doi_lg_1_i','doi_cg_i'],3,3,True)
# nodes_old_three, edges_old_three = init_graph_construction(['doi_lg_1_i','doi_lg_2_i','doi_cg_i'],3,3,True) nodes_old_three, edges_old_three = init_graph_construction(['doi_lg_1_i','doi_lg_2_i','doi_cg_i'],3,3,True)
def test_new_height(self): def test_new_height(self):
nodes_height_0, edges_height_0 = init_graph_construction(['doi_lg_1_i'],2,0,True) nodes_height_0, edges_height_0 = init_graph_construction(['doi_lg_1_i'],2,0,True)
......
...@@ -92,4 +92,5 @@ def delete_nodes_and_edges(input_list, common_nodes, old_edges_list): ...@@ -92,4 +92,5 @@ def delete_nodes_and_edges(input_list, common_nodes, old_edges_list):
valid_edges = back_to_valid_edges(old_edges_list, usable_nodes) valid_edges = back_to_valid_edges(old_edges_list, usable_nodes)
return(usable_nodes, valid_edges) return(usable_nodes, valid_edges)
\ No newline at end of file
...@@ -131,7 +131,6 @@ def update_depth(obj_input_list, input_edges, new_depth, new_height, test_var): ...@@ -131,7 +131,6 @@ def update_depth(obj_input_list, input_edges, new_depth, new_height, test_var):
back_to_valid_edges(valid_edges, processed_input_list) back_to_valid_edges(valid_edges, processed_input_list)
# adds edges between reference group and citation group of known publications # adds edges between reference group and citation group of known publications
complete_inner_edges()
return(old_depth, old_height) return(old_depth, old_height)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment