[GRASS-SVN] r74243 - in grass/trunk/scripts/v.db.droprow: . testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 13 11:36:10 PDT 2019
Author: lucadelu
Date: 2019-03-13 11:36:10 -0700 (Wed, 13 Mar 2019)
New Revision: 74243
Added:
grass/trunk/scripts/v.db.droprow/testsuite/
grass/trunk/scripts/v.db.droprow/testsuite/test_v_db_droprow.py
Log:
v.db.droprow: added test, thanks to Sanjeet Bhatti
Added: grass/trunk/scripts/v.db.droprow/testsuite/test_v_db_droprow.py
===================================================================
--- grass/trunk/scripts/v.db.droprow/testsuite/test_v_db_droprow.py (rev 0)
+++ grass/trunk/scripts/v.db.droprow/testsuite/test_v_db_droprow.py 2019-03-13 18:36:10 UTC (rev 74243)
@@ -0,0 +1,53 @@
+"""
+Created on Sun Jun 09 01:52:34 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
+from grass.script.utils import decode
+
+
+class TestVDbDropRow(TestCase):
+ """Test v.db.droprow script"""
+
+ mapName = 'elevation'
+ inputMap = 'rand5k_elev'
+ outputMap = 'rand5k_elev_filt'
+ values = 'min=56.12\nmax=155.157'
+
+ @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.del_temp_region()
+
+ cls.runModule('g.remove', flags='f', type='vector',
+ name=(cls.inputMap, cls.outputMap))
+
+ def test_drop_row_check(self):
+ """Drop vector object from a vector map"""
+ run_command('v.random', output=self.inputMap, n=5000)
+ run_command('v.db.addtable', map=self.inputMap,
+ column="elevation double precision")
+ run_command('v.what.rast', map=self.inputMap,
+ raster=self.mapName, column=self.mapName)
+
+ module = SimpleModule('v.db.droprow', input=self.inputMap,
+ output=self.outputMap, where='elevation IS NULL')
+ self.assertModule(module)
+
+ self.assertVectorFitsUnivar(map=self.outputMap, column='elevation',
+ reference=self.values, precision=5)
+
+if __name__ == '__main__':
+ test()
Property changes on: grass/trunk/scripts/v.db.droprow/testsuite/test_v_db_droprow.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