Sfoglia il codice sorgente

r.mask: added test, thanks to Sanjeet Bhatti

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74247 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 6 anni fa
parent
commit
72c8c3a0fa
1 ha cambiato i file con 42 aggiunte e 0 eliminazioni
  1. 42 0
      scripts/r.mask/testsuite/test_r_mask.py

+ 42 - 0
scripts/r.mask/testsuite/test_r_mask.py

@@ -0,0 +1,42 @@
+"""
+Created on Sun Jun 07 22:19:41 2018
+
+@author: Sanjeet Bhatti
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+from grass.gunittest.gmodules import SimpleModule
+
+
+class TestRMask(TestCase):
+    """Test r.mask script"""
+
+    mapName = 'lakes'
+    mapNameOther = 'elevation'
+    values = 'min=56.8785\nmax=134.87'
+
+    @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. Remove mask"""
+        cls.del_temp_region()
+
+        cls.runModule('r.mask', flags='r')
+
+    def test_mask(self):
+        """Mask test"""
+        module = SimpleModule('r.mask', raster=self.mapName)
+        self.assertModule(module)
+
+        self.assertRasterFitsUnivar(raster=self.mapNameOther,
+                                    reference=self.values,
+                                    precision=5)
+
+if __name__ == '__main__':
+    test()