Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anikaweinmann committed Jan 31, 2024
1 parent bc3328a commit 20f042e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions testsuite/test_v_alkis_buildings_import_BW.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ def test_file_input_single(self):
"""Tests aoi_map as optional input and federal state input file"""
self.file_input_single()


if __name__ == "__main__":
test()
1 change: 1 addition & 0 deletions testsuite/test_v_alkis_buildings_import_NW.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ def test_file_input_single(self):
"""Tests aoi_map as optional input and federal state input file"""
self.file_input_single()


if __name__ == "__main__":
test()
1 change: 1 addition & 0 deletions testsuite/test_v_alkis_buildings_import_SN.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ def test_file_input_single(self):
"""Tests aoi_map as optional input and federal state input file"""
self.file_input_single()


if __name__ == "__main__":
test()
2 changes: 1 addition & 1 deletion testsuite/test_v_alkis_buildings_import_multi_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import os

from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule
import grass.script as grass
Expand Down Expand Up @@ -150,5 +149,6 @@ def test_file_input_multi(self):
"state input file done."
)


if __name__ == "__main__":
test()
24 changes: 14 additions & 10 deletions testsuite/v_alkis_buildings_import_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import os

from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule
import grass.script as grass

Expand Down Expand Up @@ -99,7 +98,7 @@ def setUpClass(cls):
cls.runModule(
"v.import",
input=os.path.join("data", f"test_aoi_{cls.fs}.geojson"),
output=cls.aoi_map
output=cls.aoi_map,
)
# set region
grass.run_command("g.region", vector=cls.aoi_map, flags="a")
Expand Down Expand Up @@ -164,15 +163,16 @@ def flag(self):
)
# check extend of output (data should overlap with 50 percent of the
# region)
out_data_reg = grass.parse_command("v.info", map=self.test_output, flags="g")
out_data_reg = grass.parse_command(
"v.info", map=self.test_output, flags="g"
)
g_reg = grass.region()
self.assertTrue(
(
abs(float(out_data_reg["north"]) - g_reg["n"]) < 25 and
abs(float(out_data_reg["south"]) - g_reg["s"]) < 25 and
abs(float(out_data_reg["east"]) - g_reg["e"]) < 25 and
abs(float(out_data_reg["west"]) - g_reg["w"]) < 25

abs(float(out_data_reg["north"]) - g_reg["n"]) < 25
and abs(float(out_data_reg["south"]) - g_reg["s"]) < 25
and abs(float(out_data_reg["east"]) - g_reg["e"]) < 25
and abs(float(out_data_reg["west"]) - g_reg["w"]) < 25
),
"Output data extend is wrong.",
)
Expand All @@ -183,7 +183,9 @@ def file_input_single(self):
"""Tests file as input option for federal state(s) information
single federal state - case
"""
print(f"Running test for {self.fs} AOI and federal state file input...")
print(
f"Running test for {self.fs} AOI and federal state file input..."
)
# single federal state in file
v_check = SimpleModule(
"v.alkis.buildings.import",
Expand All @@ -205,4 +207,6 @@ def file_input_single(self):
self.assertTrue(
"AGS" in atr[1], "Module failed, because of missins key 'AGS'"
)
print(f"Running test for {self.fs} AOI and federal state file input done.")
print(
f"Running test for {self.fs} AOI and federal state file input done."
)
2 changes: 2 additions & 0 deletions v.alkis.buildings.import.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ def import_local_data(aoi_map, local_data_dir, fs, output_alkis_fs):

return imported_local_data


def cleanup_columns(out_alkis):
"""Remove additional columns"""
cols = grass.vector_columns(out_alkis)
Expand Down Expand Up @@ -614,6 +615,7 @@ def cleanup_columns(out_alkis):
quiet=True,
)


def main():
"""main function for processing"""
global orig_region, OUTPUT_ALKIS_TEMP, PID, dldir
Expand Down

0 comments on commit 20f042e

Please sign in to comment.