Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Jun 7, 2024
1 parent 840f19e commit 38c046d
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions raster/r.horizon/testsuite/test_r_horizon.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@
340.000000,0.196863,5004.018385
"""

ref6 = """azimuth,horizon_height,horizon_distance
180.000000,0.023101,420.000000
200.000000,0.034850,436.577599
220.000000,0.050549,184.390889
240.000000,0.048211,197.230829
260.000000,0.053101,162.788206
280.000000,0.039774,253.179778
300.000000,0.032360,277.848880
320.000000,0.014804,262.488095
340.000000,0.000000,0.000000
360.000000,0.004724,2780.017986
20.000000,0.012612,1148.259553
40.000000,0.015207,1334.166406
60.000000,0.014344,1867.966809
80.000000,0.011044,2964.203097
100.000000,0.012192,1828.223181
120.000000,0.007462,4270.667395
140.000000,0.004071,5659.231397
160.000000,0.015356,1666.883319
"""


class TestHorizon(TestCase):
circle = "circle"
Expand Down Expand Up @@ -206,16 +227,18 @@ def test_point_mode_multiple_direction_json(self):
stdout = json.loads(module.outputs.stdout)
azimuths = []
horizons = []
distances = []
reference = {}
for line in ref2.splitlines()[1:]:
azimuth, horizon = line.split(",")
for line in ref6.splitlines()[1:]:
azimuth, horizon, distance = line.split(",")
azimuths.append(float(azimuth))
horizons.append(float(horizon))
distances.append(float(distance))
reference["x"] = 634720.0
reference["y"] = 216180.0
reference["azimuth"] = azimuths
reference["horizon_height"] = horizons
stdout[0].pop("horizon_distance", None)
reference["horizon_distance"] = distances

self.assertListEqual([reference], stdout)

Expand All @@ -234,17 +257,18 @@ def test_point_mode_multiple_points_and_directions_json(self):
stdout = json.loads(module.outputs.stdout)
azimuths = []
horizons = []
distances = []
reference = {}
for line in ref2.splitlines()[1:]:
azimuth, horizon = line.split(",")
for line in ref6.splitlines()[1:]:
azimuth, horizon, distance = line.split(",")
azimuths.append(float(azimuth))
horizons.append(float(horizon))
distances.append(float(distance))
reference["x"] = 634720.0
reference["y"] = 216180.0
reference["azimuth"] = azimuths
reference["horizon_height"] = horizons
stdout[0].pop("horizon_distance", None)
stdout[1].pop("horizon_distance", None)
reference["horizon_distance"] = distances

self.assertListEqual([reference, reference], stdout)

Expand Down

0 comments on commit 38c046d

Please sign in to comment.