diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/details.md b/input/.VSCodeCounter/2021-12-24_13-19-53/details.md new file mode 100644 index 0000000000000000000000000000000000000000..92cb09557c39cd9ebb3217836e595927a3d7ae52 --- /dev/null +++ b/input/.VSCodeCounter/2021-12-24_13-19-53/details.md @@ -0,0 +1,28 @@ +# 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 diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/results.csv b/input/.VSCodeCounter/2021-12-24_13-19-53/results.csv new file mode 100644 index 0000000000000000000000000000000000000000..77ac68ce0727afa9a371eae468a7fc13e6cb360c --- /dev/null +++ b/input/.VSCodeCounter/2021-12-24_13-19-53/results.csv @@ -0,0 +1,15 @@ +"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 diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/results.md b/input/.VSCodeCounter/2021-12-24_13-19-53/results.md new file mode 100644 index 0000000000000000000000000000000000000000..dd9bc10e465df85327b145db801d55454660abce --- /dev/null +++ b/input/.VSCodeCounter/2021-12-24_13-19-53/results.md @@ -0,0 +1,25 @@ +# 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 diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/results.txt b/input/.VSCodeCounter/2021-12-24_13-19-53/results.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a04330b72336fd3ca4b5f8ca7203efb17167ca9 --- /dev/null +++ b/input/.VSCodeCounter/2021-12-24_13-19-53/results.txt @@ -0,0 +1,41 @@ +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 diff --git a/verarbeitung/test/construct_graph_unittest.py b/verarbeitung/test/construct_graph_unittest.py index 99d46afa90b9401ed6373e413972273177a6f7ba..8af37fa13cc31e10a9f2be6fd0b138d9d88d7eb6 100644 --- a/verarbeitung/test/construct_graph_unittest.py +++ b/verarbeitung/test/construct_graph_unittest.py @@ -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 diff --git a/verarbeitung/test/update_graph_unittest.py b/verarbeitung/test/update_graph_unittest.py index c44de64c5fefc2d3545b662a1f0a42d92c69af5a..63cc288dc825d5cf82a69f4381362339c7621f1c 100644 --- a/verarbeitung/test/update_graph_unittest.py +++ b/verarbeitung/test/update_graph_unittest.py @@ -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]) + diff --git a/verarbeitung/update_graph/update_depth.py b/verarbeitung/update_graph/update_depth.py index 2f0a1d8208ef02a759ac75371c624a0db6b80feb..ab4322a01abf0ad7505b0d1426e63d5cb6b96f4d 100644 --- a/verarbeitung/update_graph/update_depth.py +++ b/verarbeitung/update_graph/update_depth.py @@ -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