From cdf3d17399fb0dd987c2bdef6779441b8cbb8336 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Fri, 22 Nov 2024 13:56:31 +0100 Subject: [PATCH 1/4] add test for selection export --- ...nimal-dataset-SIA405-ABWASSER-modified.xtf | 94 +++++++++++++++++++ .../teksi_wastewater/tests/test_interlis.py | 24 +++++ 2 files changed, 118 insertions(+) diff --git a/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf b/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf index b0a8c5dea..a34e19b80 100644 --- a/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf +++ b/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf @@ -25,6 +25,18 @@ PAA.Sammelkanal Freispiegelleitung + + + 20240104 + + + 2024 + ch000000RE000002 + in_Betrieb + + + PAA.Sammelkanal + Freispiegelleitung 20240104 @@ -50,6 +62,16 @@ Kontroll_Einsteigschacht + + 20240104 + + + 2024 + Test3 + in_Betrieb + + + 20240104 @@ -57,6 +79,14 @@ Kreisprofil 1.00 Kreisprofil + + + 20240104 + + + Rechteckprofil_2_1 + 2.00 + Rechteckprofil 20240104 @@ -79,6 +109,28 @@ 2745935.9321267519.317 + + + 20240104 + + + Test2-Test3F + 447.510 + + 2745935.9321267519.317 + + + + + 20240104 + + + Test2-Test3T + 447.500 + + 2745935.9321267529.317 + + 20240104 @@ -101,6 +153,17 @@ 2745935.9321267519.317 447.510 + + + 20240104 + + + Test3 + + + 2745935.9321267529.317 + + 447.500 20240911 @@ -121,6 +184,26 @@ + + + 20240911 + + + selected_on_test_export + Test2-Test3 + + 10.00 + 300 + Kunststoff_Polyvinilchlorid + + + 2745935.9321267519.317 + 2745935.9321267529.317 + + + + + 20240104 @@ -144,6 +227,17 @@ 2745935.9321267519.317 + + 20240104 + + + Test2 + + 450.500 + + 2745935.9321267519.317 + + diff --git a/plugin/teksi_wastewater/tests/test_interlis.py b/plugin/teksi_wastewater/tests/test_interlis.py index d03ea699b..217e3017a 100644 --- a/plugin/teksi_wastewater/tests/test_interlis.py +++ b/plugin/teksi_wastewater/tests/test_interlis.py @@ -223,6 +223,30 @@ def test_minimal_import_export(self): self.assertIsNotNone(result) self.assertEqual(result[0], 448.0) + # Export selection of minimal dss + export_xtf_file = self._get_output_filename("export_minimal_dataset_dss") + interlisImporterExporter.interlis_export( + xtf_file_output=self._get_output_filename(export_xtf_file), + export_models=[config.MODEL_NAME_DSS], + logs_next_to_file=True, + selected_ids=['ch000000WN000002','ch000000WN000003','ch000000RE000002'], + ) + + # Check exported TID + export_xtf_file = self._get_output_filename("export_minimal_dataset_dss_selection") + exported_xtf_filename = self._get_output_filename( + f"{export_xtf_file}_{config.MODEL_NAME_DSS}.xtf" + ) + interlis_object = self._get_xtf_object( + exported_xtf_filename, config.TOPIC_NAME_DSS, "Rohrprofil", "ch000000PP000001" + ) + self.assertIsNone(interlis_object) + interlis_object = self._get_xtf_object( + exported_xtf_filename, config.TOPIC_NAME_DSS, "Rohrprofil", "ch000000PP000002" + ) + self.assertIsNotNone(interlis_object) + + def test_dss_dataset_import_export(self): # Import organisation xtf_file_input = self._get_data_filename(TEST_DATASET_ORGANISATIONS) From 0a606835ba8d321e370b52a3956613b514468ea1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:57:24 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- plugin/teksi_wastewater/tests/test_interlis.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/teksi_wastewater/tests/test_interlis.py b/plugin/teksi_wastewater/tests/test_interlis.py index 217e3017a..2b2f2712a 100644 --- a/plugin/teksi_wastewater/tests/test_interlis.py +++ b/plugin/teksi_wastewater/tests/test_interlis.py @@ -229,7 +229,7 @@ def test_minimal_import_export(self): xtf_file_output=self._get_output_filename(export_xtf_file), export_models=[config.MODEL_NAME_DSS], logs_next_to_file=True, - selected_ids=['ch000000WN000002','ch000000WN000003','ch000000RE000002'], + selected_ids=["ch000000WN000002", "ch000000WN000003", "ch000000RE000002"], ) # Check exported TID @@ -246,7 +246,6 @@ def test_minimal_import_export(self): ) self.assertIsNotNone(interlis_object) - def test_dss_dataset_import_export(self): # Import organisation xtf_file_input = self._get_data_filename(TEST_DATASET_ORGANISATIONS) From 1808c17ebb6b8a7d6aace79d4a065429af286ae9 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Mon, 25 Nov 2024 09:57:01 +0100 Subject: [PATCH 3/4] fix xtf --- .../tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf b/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf index a34e19b80..93b1df228 100644 --- a/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf +++ b/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER-modified.xtf @@ -231,7 +231,7 @@ 20240104 - Test2 + Test3 450.500 From fe2175b5737e9d4d38186abc039a2514fdade720 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:09:23 +0100 Subject: [PATCH 4/4] fix filename --- plugin/teksi_wastewater/tests/test_interlis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/teksi_wastewater/tests/test_interlis.py b/plugin/teksi_wastewater/tests/test_interlis.py index 2b2f2712a..db0c96678 100644 --- a/plugin/teksi_wastewater/tests/test_interlis.py +++ b/plugin/teksi_wastewater/tests/test_interlis.py @@ -224,7 +224,7 @@ def test_minimal_import_export(self): self.assertEqual(result[0], 448.0) # Export selection of minimal dss - export_xtf_file = self._get_output_filename("export_minimal_dataset_dss") + export_xtf_file = self._get_output_filename("export_minimal_dataset_dss_selection") interlisImporterExporter.interlis_export( xtf_file_output=self._get_output_filename(export_xtf_file), export_models=[config.MODEL_NAME_DSS],