[GRASS-SVN] r74237 - in grass/trunk/scripts/v.db.univar: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 13 00:31:00 PDT 2019


Author: lucadelu
Date: 2019-03-13 00:31:00 -0700 (Wed, 13 Mar 2019)
New Revision: 74237

Added:
   grass/trunk/scripts/v.db.univar/testsuite/
   grass/trunk/scripts/v.db.univar/testsuite/test_v_db_univar.py
Log:
v.db.univar: added test, thanks to Sanjeet Bhatti

Added: grass/trunk/scripts/v.db.univar/testsuite/test_v_db_univar.py
===================================================================
--- grass/trunk/scripts/v.db.univar/testsuite/test_v_db_univar.py	                        (rev 0)
+++ grass/trunk/scripts/v.db.univar/testsuite/test_v_db_univar.py	2019-03-13 07:31:00 UTC (rev 74237)
@@ -0,0 +1,47 @@
+"""
+Created on Sun Jun 08 19:08:07 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 TestVDbUnivar(TestCase):
+    """Test v.db.univar script"""
+
+    mapName = 'elevation'
+    columnName = 'heights'
+    outputMap = 'samples'
+
+    @classmethod
+    def setUpClass(cls):
+        """Use temp 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.mapName)
+        cls.del_temp_region()
+
+    def test_calculate(self):
+        """run db.univar"""
+        run_command('v.random', output=self.outputMap, n=100, overwrite='True')
+        run_command('v.db.addtable', map=self.outputMap,
+                    column="heights double precision")
+        run_command('v.what.rast', map=self.outputMap, raster=self.mapName,
+                    column=self.columnName)
+        run_command('v.db.select', map=self.outputMap)
+
+        module = SimpleModule('v.db.univar', map=self.outputMap,
+                              column=self.columnName)
+        self.assertModule(module)
+
+if __name__ == '__main__':
+    test()


Property changes on: grass/trunk/scripts/v.db.univar/testsuite/test_v_db_univar.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