Hi,
Done, attached the working file!
Thank You
Sunveer
https://sunveersingh.github.io/
On Sun, Mar 25, 2018 at 5:59 AM, Luca Delucchi <[email protected]> wrote:
> On 24 March 2018 at 16:48, Sunveer Singh <[email protected]> wrote:
> > Hi,
> >
>
> Hi Sunveer,
>
> > Let's, start with v.to.db, I attached the test for it.
> >
> > if any improvements are needed, please let me know.
> >
>
> I'm sorry but you should change something.
> In setUpClass you should copy the geology map because I run the script
> in user1 mapset and it failed.
> In tearDownClass you should remove the created map.
>
> >
> > Thank You
> > Sunveer
> > https://sunveersingh.github.io/
> >
>
> --
> ciao
> Luca
>
> www.lucadelu.org
>
"""
Name: v.to.db
Purpose: Tests v.to.db and its flags/options.
Author: Sunveer Singh
Copyright: (C) 2017 by Sunveer Singh and the GRASS Development Team
Licence: This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
import os
from grass.gunittest.case import TestCase
class Testvtodb(TestCase):
map='geology'
mapold='geology'
@classmethod
def setUpClass(cls):
cls.use_temp_region()
cls.runModule('g.copy', vector=(cls.map, cls.mapold))
@classmethod
def tearDownClass(cls):
cls.del_temp_region()
if os.path.isfile(cls.mapold):
os.remove(cls.mapold)
def testlength(self):
"""Testing option lenght and columns cat"""
self.assertModule('v.to.db', map=self.map, option="length", columns="CAT")
topology = dict(points=0)
self.assertVectorFitsTopoInfo(self.map, topology)
def testarea(self):
"""Testing option area and columns ID"""
self.assertModule('v.to.db', map=self.map, option="area", columns="ID")
topology = dict(points=0)
self.assertVectorFitsTopoInfo(self.map, topology)
def testperimeter(self):
"""Testing option perimeter and columns LABEL"""
self.assertModule('v.to.db', map=self.map, option="perimeter", columns="LABEL")
topology = dict(points=0)
self.assertVectorFitsTopoInfo(self.map, topology)
def testcount(self):
"""Testing option count and columns LOCATION"""
self.assertModule('v.to.db', map=self.map, option="count", columns="LOCATION")
topology = dict(points=0)
self.assertVectorFitsTopoInfo(self.map, topology)
def testslope(self):
"""Testing option slope and columns CITY"""
self.assertModule('v.to.db', map=self.map, option="slope", columns="CITY")
topology = dict(points=0)
self.assertVectorFitsTopoInfo(self.map, topology)
if __name__ == '__main__':
from grass.gunittest.main import test
test()
_______________________________________________
grass-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-dev