[GRASS-SVN] r74241 - in grass/trunk/scripts/v.db.dropcolumn: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 13 11:25:06 PDT 2019


Author: lucadelu
Date: 2019-03-13 11:25:06 -0700 (Wed, 13 Mar 2019)
New Revision: 74241

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

Added: grass/trunk/scripts/v.db.dropcolumn/testsuite/test_v_db_dropcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.dropcolumn/testsuite/test_v_db_dropcolumn.py	                        (rev 0)
+++ grass/trunk/scripts/v.db.dropcolumn/testsuite/test_v_db_dropcolumn.py	2019-03-13 18:25:06 UTC (rev 74241)
@@ -0,0 +1,40 @@
+"""
+Created on Sun Jun 09 01:12:22 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 TestVDbDropColumn(TestCase):
+    """Test v.db.dropcolumn script"""
+
+    @classmethod
+    def setUpClass(cls):
+        """Copy vector."""
+        run_command('g.copy', vector='roadsmajor,myroads')
+
+    @classmethod
+    def tearDownClass(cls):
+        """Remove copied vector"""
+        run_command('g.remove', type='vector', name='myroads',
+                    flags='f')
+
+    def test_drop_single_column_check(self):
+        """Drop column to the attribute table"""
+        module = SimpleModule('v.db.dropcolumn', map='myroads',
+                              columns='SHAPE_LEN')
+        self.assertModule(module)
+
+        m = SimpleModule('v.info', map='myroads', flags='c')
+        self.assertModule(m)
+        self.assertNotRegexpMatches(decode(m.outputs.stdout), 'SHAPE_LEN')
+
+if __name__ == '__main__':
+    test()



More information about the grass-commit mailing list