[GRASS-SVN] r65494 - in grass/trunk/vector/v.to.3d: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 16 20:04:03 PDT 2015


Author: annakrat
Date: 2015-06-16 20:04:03 -0700 (Tue, 16 Jun 2015)
New Revision: 65494

Added:
   grass/trunk/vector/v.to.3d/testsuite/
   grass/trunk/vector/v.to.3d/testsuite/test_vto3d.py
Log:
v.to.3d: add testsuite

Added: grass/trunk/vector/v.to.3d/testsuite/test_vto3d.py
===================================================================
--- grass/trunk/vector/v.to.3d/testsuite/test_vto3d.py	                        (rev 0)
+++ grass/trunk/vector/v.to.3d/testsuite/test_vto3d.py	2015-06-17 03:04:03 UTC (rev 65494)
@@ -0,0 +1,38 @@
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+
+
+class TestVTo3D(TestCase):
+
+    contours2d = 'test_vto3d_contours2d'
+    contours3d = 'test_vto3d_contours3d'
+
+    @classmethod
+    def setUpClass(cls):
+        cls.use_temp_region()
+        cls.runModule('g.region', raster='elevation')
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.del_temp_region()
+
+    def tearDown(cls):
+        """Remove contours map after each test method"""
+        cls.runModule('g.remove', flags='f', type='vector',
+                      name=[cls.contours2d, cls.contours3d])
+
+    def test_contours(self):
+        """Test if results is in expected limits"""
+        self.runModule('r.contour', input='elevation', output=self.contours3d, step=5)
+        self.runModule('v.db.addcolumn', map=self.contours3d, columns="z double precision")
+
+        self.assertModule('v.to.3d', input=self.contours3d, output=self.contours2d,
+                          column='z', flags='r')
+        is3d = dict(map3d=0)
+        self.assertVectorFitsTopoInfo(vector=self.contours2d, reference=is3d)
+        missing = dict(nmissing=0, nnull=0)
+        self.assertVectorFitsUnivar(map=self.contours2d, column='z', reference=missing)
+
+
+if __name__ == '__main__':
+    test()



More information about the grass-commit mailing list