| 1 |
from grass.tools import Tools |
| 2 |
|
| 3 |
|
| 4 |
def test_repeated_output(xy_dataset_session): |
| 5 |
"""Check behavior when two outputs have the same name |
| 6 |
|
| 7 |
This is practically undefined behavior, but here, we test the current behavior |
| 8 |
which is that one of the outputs wins (regardless of the order of the provided |
| 9 |
parameters or other in the interface). |
| 10 |
""" |
| 11 |
tools = Tools(session=xy_dataset_session, consistent_return_value=True) |
| 12 |
name = "output_1" |
| 13 |
|
| 14 |
tools.r_slope_aspect(elevation="rows_raster", aspect=name, slope=name) |
| 15 |
stats = tools.r_univar(map=name, format="json") |
| 16 |
# This is slope. |
| 17 |
assert stats["min"] == 45 |
| 18 |
assert stats["max"] == 45 |
| 19 |
assert stats["sum"] == 540 |
| 20 |
|
| 21 |
name = "output_2" |
| 22 |
tools.r_slope_aspect(elevation="rows_raster", dx=name, dy=name, slope=name) |
| 23 |
stats = tools.r_univar(map=name, format="json") |
| 24 |
# This is dy. |
| 25 |
assert stats["min"] == 1 |
| 26 |
assert stats["max"] == 1 |
| 27 |
assert stats["sum"] == 12 |