[GRASS-SVN] r64639 - in grass/trunk/vector/v.net: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 15 13:07:33 PST 2015


Author: annakrat
Date: 2015-02-15 13:07:33 -0800 (Sun, 15 Feb 2015)
New Revision: 64639

Added:
   grass/trunk/vector/v.net/testsuite/
   grass/trunk/vector/v.net/testsuite/test_v_net.py
Log:
v.net: test added

Added: grass/trunk/vector/v.net/testsuite/test_v_net.py
===================================================================
--- grass/trunk/vector/v.net/testsuite/test_v_net.py	                        (rev 0)
+++ grass/trunk/vector/v.net/testsuite/test_v_net.py	2015-02-15 21:07:33 UTC (rev 64639)
@@ -0,0 +1,49 @@
+import grass.gunittest
+from grass.script.core import read_command
+
+
+class TestVNet(grass.gunittest.TestCase):
+
+    network = 'test_vnet'
+
+    def tearDown(cls):
+        """Remove viewshed map after each test method"""
+        # TODO: eventually, removing maps should be handled through testing framework fucntions
+        cls.runModule('g.remove', flags='f', type='vector',
+                      name=cls.network)
+
+    def test_nodes(self):
+        """Test"""
+        self.assertModule('v.net', input='streets_wake', output=self.network, operation='nodes')
+        topology = dict(points=41813, nodes=41813, lines=49746)
+        self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
+        layers = read_command('v.category', input=self.network, option='layers').strip()
+        self.assertEqual(first="1", second=layers, msg="Layers do not match")
+
+    def test_nodes_layers(self):
+        """Test"""
+        self.assertModule('v.net', input='streets_wake', output=self.network, operation='nodes', flags='c')
+        topology = dict(points=41813, nodes=41813, lines=49746)
+        self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
+        layers = read_command('v.category', input=self.network, option='layers').strip()
+        self.assertEqual(first="1\n2", second=layers, msg="Layers do not match")
+
+    def test_connect(self):
+        """Test"""
+        self.assertModule('v.net', input='streets_wake', points='schools_wake',
+                          output=self.network, operation='connect', threshold=1000)
+        topology = dict(points=167, nodes=42136, lines=50080)
+        self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
+        layers = read_command('v.category', input=self.network, option='layers').strip()
+        self.assertEqual(first="1\n2", second=layers, msg="Layers do not match")
+
+    def test_connect_snap(self):
+        """Test"""
+        self.assertModule('v.net', input='streets_wake', points='schools_wake', flags='s',
+                          output=self.network, operation='connect', threshold=1000)
+        topology = dict(points=167, nodes=41969, lines=49913)
+        self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
+
+
+if __name__ == '__main__':
+    grass.gunittest.test()



More information about the grass-commit mailing list