[GRASS-SVN] r74239 - in grass/trunk/scripts/v.db.addcolumn: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 13 11:21:48 PDT 2019


Author: lucadelu
Date: 2019-03-13 11:21:48 -0700 (Wed, 13 Mar 2019)
New Revision: 74239

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

Added: grass/trunk/scripts/v.db.addcolumn/testsuite/test_v_db_addcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.addcolumn/testsuite/test_v_db_addcolumn.py	                        (rev 0)
+++ grass/trunk/scripts/v.db.addcolumn/testsuite/test_v_db_addcolumn.py	2019-03-13 18:21:48 UTC (rev 74239)
@@ -0,0 +1,52 @@
+"""
+Created on Sun Jun 09 11:28: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 TestVDbAddColumn(TestCase):
+    """Test v.db.addcolumn 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_add_single_column_check(self):
+        """Add column to the attribute table"""
+        module = SimpleModule('v.db.addcolumn', map='myroads',
+                              columns='slope double precision')
+        self.assertModule(module)
+
+        m = SimpleModule('v.info', map='myroads', flags='c')
+        self.assertModule(m)
+        self.assertRegexpMatches(decode(m.outputs.stdout), 'slope')
+
+    def test_add_two_columns_check(self):
+        """Add two column to the attribute table"""
+        module = SimpleModule('v.db.addcolumn', map='myroads',
+                              columns='slope_2 double precision, \
+                              myname varchar(15)')
+        self.assertModule(module)
+
+        m = SimpleModule('v.info', map='myroads', flags='c')
+        self.assertModule(m)
+        self.assertRegexpMatches(decode(m.outputs.stdout), 'slope_2')
+        self.assertRegexpMatches(decode(m.outputs.stdout), 'myname')
+
+if __name__ == '__main__':
+    test()


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