[GRASS-SVN] r71997 - in grass/trunk/raster/r.report: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 29 00:52:44 PST 2017


Author: lucadelu
Date: 2017-12-29 00:52:43 -0800 (Fri, 29 Dec 2017)
New Revision: 71997

Added:
   grass/trunk/raster/r.report/testsuite/
   grass/trunk/raster/r.report/testsuite/test_r_report.py
Log:
r.report: added tests, thanks to Sunveer Singh during Google Code-in 2017

Added: grass/trunk/raster/r.report/testsuite/test_r_report.py
===================================================================
--- grass/trunk/raster/r.report/testsuite/test_r_report.py	                        (rev 0)
+++ grass/trunk/raster/r.report/testsuite/test_r_report.py	2017-12-29 08:52:43 UTC (rev 71997)
@@ -0,0 +1,73 @@
+"""
+Name:       r.report test
+Purpose:    Tests r.report and its flags/options.
+
+Author:     Sunveer Singh, Google Code-in 2017
+Copyright:  (C) 2017 by Sunveer Singh and the GRASS Development Team
+Licence:    This program is free software under the GNU General Public
+            License (>=v2). Read the file COPYING that comes with GRASS
+            for details.
+"""
+
+import os
+from grass.gunittest.case import TestCase
+
+
+class TestRasterreport(TestCase):
+    outfile = 'test_out.csv'
+
+
+    @classmethod
+    def setUpClass(cls):
+        """Use temporary region settings"""
+        cls.use_temp_region()
+
+
+    @classmethod
+    def tearDownClass(cls):
+        """!Remove the temporary region
+        """
+        cls.del_temp_region()
+        if os.path.isfile(cls.outfile):
+            os.remove(cls.outfile)
+
+
+    def test_flage(self):
+        """Testing flag 'e' with map elevation"""
+        self.assertModule('r.report', map='elevation', flags='e')
+
+
+    def test_flagc(self):
+        """Testing flag 'c' with map aspect"""
+        self.assertModule('r.report', map='aspect', flags='c')
+
+
+    def test_flagf(self):
+        """Testing flag 'f' with map lakes"""
+        self.assertModule('r.report', map='lakes', flags='f')
+
+
+    def test_flagh(self):
+        """Testing flag 'h' with map slope"""
+        self.assertModule('r.report', map='slope', flags='h')
+
+
+    def test_flagn(self):
+        """Testing flag 'n' with map urban"""
+        self.assertModule('r.report', map='urban', flags='n')
+
+
+    def test_flaga(self):
+        """Testing flag 'a' with map zipcodes"""
+        self.assertModule('r.report', map='zipcodes', flags='a')
+
+
+    def test_output(self):
+        """Checking file existence"""
+        self.assertModule('r.report', map='lakes', output=self.outfile)
+        self.assertFileExists(self.outfile)
+
+
+if __name__ == '__main__':
+    from grass.gunittest.main import test
+    test()


Property changes on: grass/trunk/raster/r.report/testsuite/test_r_report.py
___________________________________________________________________
Added: svn:mime-type
   + text/x-python
Added: svn:eol-style
   + native



More information about the grass-commit mailing list