[GRASS-SVN] r54677 - grass-addons/grass7/raster/r.agent/tests

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 16 10:38:33 PST 2013


Author: mic
Date: 2013-01-16 10:38:33 -0800 (Wed, 16 Jan 2013)
New Revision: 54677

Modified:
   grass-addons/grass7/raster/r.agent/tests/test_grassland.py
   grass-addons/grass7/raster/r.agent/tests/test_playground.py
Log:
improved tests

Modified: grass-addons/grass7/raster/r.agent/tests/test_grassland.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_grassland.py	2013-01-16 18:21:21 UTC (rev 54676)
+++ grass-addons/grass7/raster/r.agent/tests/test_grassland.py	2013-01-16 18:38:33 UTC (rev 54677)
@@ -12,13 +12,25 @@
         self.assertIsNotNone(self.pg.getregion())
 
     def test_getbound(self):
-        self.assertIsNotNone(self.pg.getbound("n"))
-        self.assertIsNotNone(self.pg.getbound("s"))
-        self.assertIsNotNone(self.pg.getbound("w"))
-        self.assertIsNotNone(self.pg.getbound("e"))
-        self.assertTrue(self.pg.getbound("n")>self.pg.getbound("s"))
-        self.assertTrue(self.pg.getbound("e")>self.pg.getbound("w"))
+        n = self.pg.region["n"]
+        s = self.pg.region["s"]
+        w = self.pg.region["w"]
+        e = self.pg.region["e"]
+        ns = self.pg.region["nsres"]
+        ew = self.pg.region["ewres"]
+        r = self.pg.region["rows"]
+        c = self.pg.region["cols"]
+                            
+        self.assertIsNotNone(n)
+        self.assertIsNotNone(s)
+        self.assertIsNotNone(w)
+        self.assertIsNotNone(e)
+        self.assertTrue(n>s)
+        self.assertTrue(e>w)
 
+        self.assertEqual((n-s)/ns, r)
+        self.assertEqual((e-w)/ew, c)
+
     #def test_setlayer(self):
        # gets tested in createlayer and super()/Playground
 

Modified: grass-addons/grass7/raster/r.agent/tests/test_playground.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_playground.py	2013-01-16 18:21:21 UTC (rev 54676)
+++ grass-addons/grass7/raster/r.agent/tests/test_playground.py	2013-01-16 18:38:33 UTC (rev 54677)
@@ -12,13 +12,28 @@
         self.assertIsNotNone(self.pg.getregion())
 
     def test_getbound(self):
-        self.assertIsNotNone(self.pg.getbound("n"))
-        self.assertIsNotNone(self.pg.getbound("s"))
-        self.assertIsNotNone(self.pg.getbound("w"))
-        self.assertIsNotNone(self.pg.getbound("e"))
-        self.assertTrue(self.pg.getbound("n")>self.pg.getbound("s"))
-        self.assertTrue(self.pg.getbound("e")>self.pg.getbound("w"))
+        n = self.pg.region["n"]
+        s = self.pg.region["s"]
+        w = self.pg.region["w"]
+        e = self.pg.region["e"]
+        #TODO needed?
+#        ns = self.pg.region["nsres"]
+        ns = 1
+#        ew = self.pg.region["ewres"]
+        ew = 1
+        r = self.pg.region["rows"]
+        c = self.pg.region["cols"]
+  
+        self.assertIsNotNone(n)
+        self.assertIsNotNone(s)
+        self.assertIsNotNone(w)
+        self.assertIsNotNone(e)
+        self.assertTrue(n>s)
+        self.assertTrue(e>w)
 
+        self.assertEqual((n-s)/ns, r)
+        self.assertEqual((e-w)/ew, c)
+
     def test_setlayer(self):
         layer = [0]
         key = "foo"



More information about the grass-commit mailing list