[GRASS-SVN] r74240 - in grass/trunk/scripts/v.db.addtable: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 13 11:23:50 PDT 2019


Author: lucadelu
Date: 2019-03-13 11:23:50 -0700 (Wed, 13 Mar 2019)
New Revision: 74240

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

Added: grass/trunk/scripts/v.db.addtable/testsuite/test_v_db_addtable.py
===================================================================
--- grass/trunk/scripts/v.db.addtable/testsuite/test_v_db_addtable.py	                        (rev 0)
+++ grass/trunk/scripts/v.db.addtable/testsuite/test_v_db_addtable.py	2019-03-13 18:23:50 UTC (rev 74240)
@@ -0,0 +1,46 @@
+"""
+Created on Sun Jun 09 12:01: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 TestVDbAddTable(TestCase):
+    """Test v.db.addtable 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_columned_table_check(self):
+        """Add a new attribute table with single column to layer 2"""
+        module = SimpleModule('v.db.addtable', map='myroads',
+                              columns='slope double precision', layer=2)
+        self.assertModule(module)
+
+        run_command('v.db.connect', flags='p', map='myroads')
+
+        m = SimpleModule('v.info', map='myroads', flags='c')
+        self.assertModule(m)
+        self.assertNotRegexpMatches(decode(m.outputs.stdout), 'slope')
+
+        m = SimpleModule('v.info', map='myroads', flags='c', layer=2)
+        self.assertModule(m)
+        self.assertRegexpMatches(decode(m.outputs.stdout), 'slope')
+
+if __name__ == '__main__':
+    test()


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