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

updated unit test for update graph

parent 1c5fe50d
No related branches found
No related tags found
1 merge request!14stable version and bug fixes for graph update
This commit is part of merge request !14. Comments created here will be created in the context of that merge request.
# Details
Date : 2021-12-24 13:19:53
Directory c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input
Total : 13 files, 686 codes, 251 comments, 161 blanks, all 1098 lines
[summary](results.md)
## Files
| filename | language | code | comment | blank | total |
| :--- | :--- | ---: | ---: | ---: | ---: |
| [README.md](/README.md) | Markdown | 38 | 0 | 12 | 50 |
| [__init__.py](/__init__.py) | Python | 0 | 0 | 1 | 1 |
| [get/__init__.py](/get/__init__.py) | Python | 0 | 0 | 1 | 1 |
| [get/acs.py](/get/acs.py) | Python | 105 | 41 | 47 | 193 |
| [get/journal_fetcher.py](/get/journal_fetcher.py) | Python | 59 | 25 | 12 | 96 |
| [get/nature.py](/get/nature.py) | Python | 21 | 23 | 16 | 60 |
| [get/template_.py](/get/template_.py) | Python | 10 | 31 | 10 | 51 |
| [interface.py](/interface.py) | Python | 46 | 47 | 21 | 114 |
| [publication.py](/publication.py) | Python | 80 | 49 | 15 | 144 |
| [requirements.txt](/requirements.txt) | pip requirements | 2 | 0 | 0 | 2 |
| [test/__init__.py](/test/__init__.py) | Python | 0 | 0 | 1 | 1 |
| [test/test_acs.py](/test/test_acs.py) | Python | 285 | 7 | 11 | 303 |
| [test/test_input.py](/test/test_input.py) | Python | 40 | 28 | 14 | 82 |
[summary](results.md)
\ No newline at end of file
"filename", "language", "Python", "pip requirements", "Markdown", "comment", "blank", "total"
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\README.md", "Markdown", 0, 0, 38, 0, 12, 50
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\__init__.py", "Python", 0, 0, 0, 0, 1, 1
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\__init__.py", "Python", 0, 0, 0, 0, 1, 1
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\acs.py", "Python", 105, 0, 0, 41, 47, 193
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\journal_fetcher.py", "Python", 59, 0, 0, 25, 12, 96
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\nature.py", "Python", 21, 0, 0, 23, 16, 60
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\template_.py", "Python", 10, 0, 0, 31, 10, 51
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\interface.py", "Python", 46, 0, 0, 47, 21, 114
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\publication.py", "Python", 80, 0, 0, 49, 15, 144
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\requirements.txt", "pip requirements", 0, 2, 0, 0, 0, 2
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\__init__.py", "Python", 0, 0, 0, 0, 1, 1
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_acs.py", "Python", 285, 0, 0, 7, 11, 303
"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_input.py", "Python", 40, 0, 0, 28, 14, 82
"Total", "-", 646, 2, 38, 251, 161, 1098
\ No newline at end of file
# Summary
Date : 2021-12-24 13:19:53
Directory c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input
Total : 13 files, 686 codes, 251 comments, 161 blanks, all 1098 lines
[details](details.md)
## Languages
| language | files | code | comment | blank | total |
| :--- | ---: | ---: | ---: | ---: | ---: |
| Python | 11 | 646 | 251 | 149 | 1,046 |
| Markdown | 1 | 38 | 0 | 12 | 50 |
| pip requirements | 1 | 2 | 0 | 0 | 2 |
## Directories
| path | files | code | comment | blank | total |
| :--- | ---: | ---: | ---: | ---: | ---: |
| . | 13 | 686 | 251 | 161 | 1,098 |
| get | 5 | 195 | 120 | 86 | 401 |
| test | 3 | 325 | 35 | 26 | 386 |
[details](details.md)
\ No newline at end of file
Date : 2021-12-24 13:19:53
Directory : c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input
Total : 13 files, 686 codes, 251 comments, 161 blanks, all 1098 lines
Languages
+------------------+------------+------------+------------+------------+------------+
| language | files | code | comment | blank | total |
+------------------+------------+------------+------------+------------+------------+
| Python | 11 | 646 | 251 | 149 | 1,046 |
| Markdown | 1 | 38 | 0 | 12 | 50 |
| pip requirements | 1 | 2 | 0 | 0 | 2 |
+------------------+------------+------------+------------+------------+------------+
Directories
+---------------------------------------------------------------------------+------------+------------+------------+------------+------------+
| path | files | code | comment | blank | total |
+---------------------------------------------------------------------------+------------+------------+------------+------------+------------+
| . | 13 | 686 | 251 | 161 | 1,098 |
| get | 5 | 195 | 120 | 86 | 401 |
| test | 3 | 325 | 35 | 26 | 386 |
+---------------------------------------------------------------------------+------------+------------+------------+------------+------------+
Files
+---------------------------------------------------------------------------+------------------+------------+------------+------------+------------+
| filename | language | code | comment | blank | total |
+---------------------------------------------------------------------------+------------------+------------+------------+------------+------------+
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\README.md | Markdown | 38 | 0 | 12 | 50 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\__init__.py | Python | 0 | 0 | 1 | 1 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\__init__.py | Python | 0 | 0 | 1 | 1 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\acs.py | Python | 105 | 41 | 47 | 193 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\journal_fetcher.py | Python | 59 | 25 | 12 | 96 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\nature.py | Python | 21 | 23 | 16 | 60 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\template_.py | Python | 10 | 31 | 10 | 51 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\interface.py | Python | 46 | 47 | 21 | 114 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\publication.py | Python | 80 | 49 | 15 | 144 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\requirements.txt | pip requirements | 2 | 0 | 0 | 2 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\__init__.py | Python | 0 | 0 | 1 | 1 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_acs.py | Python | 285 | 7 | 11 | 303 |
| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_input.py | Python | 40 | 28 | 14 | 82 |
| Total | | 686 | 251 | 161 | 1,098 |
+---------------------------------------------------------------------------+------------------+------------+------------+------------+------------+
\ No newline at end of file
......@@ -7,7 +7,7 @@ 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
from verarbeitung.get_pub_from_input import input_test_func
class ConstructionTest(unittest.TestCase):
maxDiff = None
......
......@@ -8,7 +8,9 @@ sys.path.append("../")
from verarbeitung.construct_new_graph.initialize_graph import init_graph_construction
from verarbeitung.construct_new_graph.export_to_json import output_to_json
from verarbeitung.update_graph.import_from_json import input_from_json
from verarbeitung.update_graph.update_graph import update_graph
from verarbeitung.update_graph.update_graph import update_graph, get_old_input_dois, get_new_input_dois
from verarbeitung.update_graph.update_depth import reduce_max_height_depth_test, get_old_height_depth
from verarbeitung.get_pub_from_input import input_test_func
class UpdatingTest(unittest.TestCase):
maxDiff = None
......@@ -48,6 +50,60 @@ class UpdatingTest(unittest.TestCase):
self.assertCountEqual(nodes_height_0, nodes_new_height_0)
self.assertCountEqual(edges_height_0, edges_new_height_0)
## Ab hier die Tests für die einzelnen Funktionen ##
# update_graph.py:
def test_get_old_input_dois(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
old_pubs = [pub_lg_1_i, pub_lg_1_h_11, pub_lg_1_d_11]
self.assertCountEqual(get_old_input_dois(old_pubs),['doi_lg_1_i'])
# hard to test because we only have dois as test objects and no urls variant
def test_get_new_input_dois(self):
new_dois = ['pub_lg_2_i', 'pub_lg_1_i', 'pub_lg_c_i']
self.assertCountEqual(get_new_input_dois(new_dois, True), ['pub_lg_2_i', 'pub_lg_1_i', 'pub_lg_c_i'])
# update_depth.py:
def test_reduce_max_height(self):
pub_lg_2_i = input_test_func('doi_lg_2_i')
pub_lg_2_i.group = 0
pub_lg_2_h_11 = input_test_func('doi_lg_2_h11')
pub_lg_2_h_11.group = 1
pub_lg_2_d_11 = input_test_func('doi_lg_2_d11')
pub_lg_2_d_11.group = -1
pub_lg_2_h_21 = input_test_func('doi_lg_2_h21')
pub_lg_2_h_21.group = 2
pub_lg_2_d_21 = input_test_func('doi_lg_2_d21')
pub_lg_2_d_21.group = -2
pubs = [pub_lg_2_i, pub_lg_2_h_11, pub_lg_2_h_21, pub_lg_2_d_11, pub_lg_2_d_21]
self.assertCountEqual(reduce_max_height_depth_test(pubs, 2, "Height"), [pub_lg_2_i, pub_lg_2_h_11, pub_lg_2_h_21, pub_lg_2_d_11, pub_lg_2_d_21])
self.assertCountEqual(reduce_max_height_depth_test(pubs, 1, "Height"), [pub_lg_2_i, pub_lg_2_h_11, pub_lg_2_d_11, pub_lg_2_d_21])
self.assertCountEqual(reduce_max_height_depth_test(pubs, 0, "Height"), [pub_lg_2_i, pub_lg_2_d_11, pub_lg_2_d_21])
def test_reduce_max_depth(self):
pub_lg_2_i = input_test_func('doi_lg_2_i')
pub_lg_2_i.group = 0
pub_lg_2_h_11 = input_test_func('doi_lg_2_h11')
pub_lg_2_h_11.group = 1
pub_lg_2_d_11 = input_test_func('doi_lg_2_d11')
pub_lg_2_d_11.group = -1
pub_lg_2_h_21 = input_test_func('doi_lg_2_h21')
pub_lg_2_h_21.group = 2
pub_lg_2_d_21 = input_test_func('doi_lg_2_d21')
pub_lg_2_d_21.group = -2
pubs = [pub_lg_2_i, pub_lg_2_h_11, pub_lg_2_h_21, pub_lg_2_d_11, pub_lg_2_d_21]
self.assertCountEqual(reduce_max_height_depth_test(pubs, 2, "Depth"), [pub_lg_2_i, pub_lg_2_h_11, pub_lg_2_h_21, pub_lg_2_d_11, pub_lg_2_d_21])
self.assertCountEqual(reduce_max_height_depth_test(pubs, 1, "Depth"), [pub_lg_2_i, pub_lg_2_d_11, pub_lg_2_h_11, pub_lg_2_h_21])
self.assertCountEqual(reduce_max_height_depth_test(pubs, 0, "Depth"), [pub_lg_2_i, pub_lg_2_h_11, pub_lg_2_h_21])
......
......@@ -23,6 +23,29 @@ from .update_edges import back_to_valid_edges
from input.publication import Publication
def reduce_max_height_depth_test(pubs, max_hd, hd_var):
'''
:param pubs: list of publication to reduce height/depth in
:type pubs: List[Publication]
:param max_hd: new maximum height/depth to reduce publications in publication list to
:type max_hd: int
:param hd_var: defines if depth or height gets to be reduced
:type hd_var: String
for unit test purposes only
'''
global processed_input_list
processed_input_list = pubs
if hd_var == "Height":
reduce_max_height(max_hd)
else:
reduce_max_depth(max_hd)
return processed_input_list
def reduce_max_height(max_height):
'''
:param max_height: new maximum height to reduce publications in publication list to
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment