[GRASS-SVN] r72530 - in grass/trunk/raster/r.mode: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 23 08:54:52 PDT 2018


Author: lucadelu
Date: 2018-03-23 08:54:52 -0700 (Fri, 23 Mar 2018)
New Revision: 72530

Added:
   grass/trunk/raster/r.mode/testsuite/
   grass/trunk/raster/r.mode/testsuite/testrmode.py
Log:
r.mode: added testsuite, thanks to Supreet Singh

Added: grass/trunk/raster/r.mode/testsuite/testrmode.py
===================================================================
--- grass/trunk/raster/r.mode/testsuite/testrmode.py	                        (rev 0)
+++ grass/trunk/raster/r.mode/testsuite/testrmode.py	2018-03-23 15:54:52 UTC (rev 72530)
@@ -0,0 +1,54 @@
+"""
+Name:       r.mode test
+Purpose:    Tests r.mode and its flags/options.
+    
+Author:     Supreet Singh
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+
+class Testrmode(TestCase):
+    output='rmode'
+    base='facility'
+    cover='soils_Kfactor'
+
+    @classmethod
+    def setUpClass(cls):
+        cls.use_temp_region()
+        cls.runModule('g.region', flags='d')
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.del_temp_region()
+
+    def tearDown(self):
+        self.runModule('g.remove', type='raster', flags='f', name=self.output)
+
+    def test_1(self):
+        facility='facility'
+        self.assertModule('r.mode', base=self.base, cover=self.cover,
+                          output=self.output)
+        self.assertRasterMinMax(map=facility, refmin=1, refmax=1,
+                                msg="facility in degrees must be between "
+                                    "1 and 1")
+
+    def test_2(self):
+        slope='slope'
+        self.assertModule('r.mode', base=self.base, cover=self.cover,
+                          output=self.output)
+        self.assertRasterMinMax(map=slope, refmin=0, refmax=38.68939,
+                                msg="slope in degrees must be between 0 and "
+                                    "38.68939")
+
+    def test_3(self):
+        elevation='elevation'
+        self.assertModule('r.mode', base=self.base, cover=self.cover,
+                          output=self.output)
+        self.assertRasterMinMax(map=elevation, refmin=55.57879,
+                                refmax=156.3299, msg="elevation in degrees "
+                                "must be between 55.57879 and 156.3299")
+
+if __name__ == '__main__':
+    test()
+


Property changes on: grass/trunk/raster/r.mode/testsuite/testrmode.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