[GRASS-SVN] r74246 - in grass/trunk/scripts/r.grow: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 13 11:43:33 PDT 2019


Author: lucadelu
Date: 2019-03-13 11:43:33 -0700 (Wed, 13 Mar 2019)
New Revision: 74246

Added:
   grass/trunk/scripts/r.grow/testsuite/
   grass/trunk/scripts/r.grow/testsuite/test_r_grow.py
Log:
r.grow: added test, thanks to Sanjeet Bhatti

Added: grass/trunk/scripts/r.grow/testsuite/test_r_grow.py
===================================================================
--- grass/trunk/scripts/r.grow/testsuite/test_r_grow.py	                        (rev 0)
+++ grass/trunk/scripts/r.grow/testsuite/test_r_grow.py	2019-03-13 18:43:33 UTC (rev 74246)
@@ -0,0 +1,49 @@
+"""
+Created on Sun Jun 07 22:09:41 2018
+
+ at author: Sanjeet Bhatti
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+from grass.gunittest.gmodules import SimpleModule
+from grass.script.core import run_command
+
+
+class TestRGrow(TestCase):
+    """Test r.grow script"""
+
+    mapName = 'lakes'
+    mapGrownOutput = 'lakes_grown_100m'
+    mapShrunkOutput = 'lakes_shrunk_100m'
+
+    @classmethod
+    def setUpClass(cls):
+        """Create maps in a small region."""
+        cls.use_temp_region()
+        cls.runModule('g.region', raster=cls.mapName, flags='p')
+
+    @classmethod
+    def tearDownClass(cls):
+        """Remove temporary region"""
+        cls.runModule('g.remove', flags='f', type='raster',
+                      name=(cls.mapGrownOutput,
+                            cls.mapShrunkOutput))
+        cls.del_temp_region()
+
+    def test_grow(self):
+        """Grow test"""
+        module = SimpleModule('r.grow', input=self.mapName,
+                              output=self.mapGrownOutput,
+                              radius=10)
+        self.assertModule(module)
+
+    def test_shrink(self):
+        """Shrink test"""
+        module = SimpleModule('r.grow', input=self.mapName,
+                              output=self.mapShrunkOutput,
+                              radius=-10)
+        self.assertModule(module)
+
+if __name__ == '__main__':
+    test()


Property changes on: grass/trunk/scripts/r.grow/testsuite/test_r_grow.py
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the grass-commit mailing list