Skip to content

Commit

Permalink
r.watershed: improve testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
metzm committed Sep 6, 2023
1 parent 6e7a0f4 commit 0ec0004
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions raster/r.watershed/testsuite/r_watershed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ def test_thresholdsize(self):
)
# it is expected that 100k Threshold has a min=2 and max=12 for this
# data
self.assertRasterMinMax(self.basin, 2, 12)
reference = "min=2\nmax=12"
self.assertRasterFitsUnivar(
self.basin,
reference=reference,
msg="Basin values must be in the range [2, 12]",
)
# it is expected that 100k Threshold has a min=2 and max=256 for this
# data
self.assertModule(
Expand All @@ -173,7 +178,12 @@ def test_thresholdsize(self):
basin=self.basin,
overwrite=True,
)
self.assertRasterMinMax(self.basin, 2, 256)
reference = "min=2\nmax=256"
self.assertRasterFitsUnivar(
self.basin,
reference=reference,
msg="Basin values must be in the range [2, 256]",
)

def test_drainageDirection(self):
"""Test if the drainage direction is between -8 and 8."""
Expand All @@ -198,11 +208,11 @@ def test_basinValue(self):
# TODO: test just min, max is theoretically unlimited
# or set a lower value according to what is expected with this data
# TODO: add test which tests that 'max basin id' == 'num of basins'
self.assertRasterMinMax(
reference = "min=2\nmax=256"
self.assertRasterFitsUnivar(
self.basin,
0,
1000000,
msg="A basin value is less than 0 or greater than 1000000",
reference=reference,
msg="Basin values must be in the range [2, 256]",
)


Expand Down

0 comments on commit 0ec0004

Please sign in to comment.