Skip to content

Commit

Permalink
testsuite: r.grow test shrinking map without NULL values
Browse files Browse the repository at this point in the history
Based on PR OSGeo#343
  • Loading branch information
marisn committed Feb 18, 2020
1 parent c549756 commit 788758a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions scripts/r.grow/testsuite/test_r_grow.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Created on Sun Jun 07 22:09:41 2018
@author: Sanjeet Bhatti
@author: Sanjeet Bhatti, Maris Nartiss
"""

from grass.gunittest.case import TestCase
Expand All @@ -16,6 +16,8 @@ class TestRGrow(TestCase):
mapName = 'lakes'
mapGrownOutput = 'lakes_grown_100m'
mapShrunkOutput = 'lakes_shrunk_100m'
mapNoNULL = 'elevation'
mapShrunkNoNULL = 'elevation_shrunk'

@classmethod
def setUpClass(cls):
Expand All @@ -28,7 +30,8 @@ def tearDownClass(cls):
"""Remove temporary region"""
cls.runModule('g.remove', flags='f', type='raster',
name=(cls.mapGrownOutput,
cls.mapShrunkOutput))
cls.mapShrunkOutput,
cls.mapShrunkNoNULL))
cls.del_temp_region()

def test_grow(self):
Expand All @@ -45,5 +48,18 @@ def test_shrink(self):
radius=-10)
self.assertModule(module)

def test_shrink_null(self):
"""Shrinking of map without NULL values
Based on https://github.com/OSGeo/grass/pull/343"""
shrinked_string = '56-156'
shrinked = SimpleModule('r.grow', input=self.mapNoNULL,
output=self.mapShrunkNoNULL,
radius=-10)
self.assertModule(shrinked)

shrined_range = SimpleModule('r.describe', flags='i', _map=self.mapShrunkNoNULL)
self.runModule(shrined_range)
self.assertLooksLike(shrinked_string, str(shrined_range.outputs.stdout).strip())

if __name__ == '__main__':
test()

0 comments on commit 788758a

Please sign in to comment.