[GRASS-SVN] r67878 - grass/trunk/temporal/t.connect/testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 18 02:40:27 PST 2016


Author: lucadelu
Date: 2016-02-18 02:40:26 -0800 (Thu, 18 Feb 2016)
New Revision: 67878

Modified:
   grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py
   grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py
   grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py
Log:
testsuite: added tests for t.list, t.rast.list, t.vect.list, t.raster3d.list with output parameter

Modified: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py
===================================================================
--- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py	2016-02-18 10:33:00 UTC (rev 67877)
+++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py	2016-02-18 10:40:26 UTC (rev 67878)
@@ -18,6 +18,7 @@
 class TestRasterExtraction(TestCase):
 
     mapsets_to_remove = []
+    outfile = 'rastlist.txt'
 
     @classmethod
     def setUpClass(cls):
@@ -78,6 +79,20 @@
         for a, b in zip(list_string.split("\n"), out.split("\n")):
             self.assertEqual(a.strip(), b.strip())
 
+        t_list = SimpleModule(
+            "t.list", quiet=True,
+            columns=["name", "mapset,start_time", "end_time", "number_of_maps"],
+            type="strds", where='name = "A"', output=self.outfile)
+        self.assertModule(t_list)
+        self.assertFileExists(self.outfile)
+        with open(self.outfile, 'r') as f:
+            read_data = f.read()
+        for a, b in zip(list_string.split("\n"), read_data.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        #self.assertLooksLike(reference=read_data, actual=list_string)
+        if os.path.isfile(self.outfile):
+            os.remove(self.outfile)
+
     def test_trast_list(self):
         self.runModule("g.mapset", mapset="test1")
 
@@ -146,6 +161,17 @@
         for a, b in zip(list_string.split("\n"), out.split("\n")):
             self.assertEqual(a.strip(), b.strip())
 
+        trast_list = SimpleModule("t.rast.list", quiet=True, flags="s",
+                                  input="A at test5", output=self.outfile)
+        self.assertModule(trast_list)
+        self.assertFileExists(self.outfile)
+        with open(self.outfile, 'r') as f:
+            read_data = f.read()
+        for a, b in zip(list_string.split("\n"), read_data.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        if os.path.isfile(self.outfile):
+            os.remove(self.outfile)
+
     def test_strds_info(self):
         self.runModule("g.mapset", mapset="test4")
         tinfo_string = """id=A at test1
@@ -265,9 +291,8 @@
 
         info = SimpleModule(
             "t.info", flags="g", type="raster", input="a1 at test5")
-        self.assertModuleKeyValue(
-            module=info, reference=tinfo_string, precision=2, sep="=")
 
+
 if __name__ == '__main__':
     from grass.gunittest.main import test
     test()

Modified: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py
===================================================================
--- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py	2016-02-18 10:33:00 UTC (rev 67877)
+++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py	2016-02-18 10:40:26 UTC (rev 67878)
@@ -17,6 +17,7 @@
 class testRaster3dExtraction(TestCase):
 
     mapsets_to_remove = []
+    outfile = 'rast3dlist.txt'
 
     @classmethod
     def setUpClass(cls):
@@ -77,6 +78,20 @@
         for a, b in zip(list_string.split("\n"), out.split("\n")):
             self.assertEqual(a.strip(), b.strip())
 
+        t_list = SimpleModule(
+            "t.list", quiet=True,
+            columns=["name", "mapset,start_time", "end_time", "number_of_maps"],
+            type="str3ds", where='name = "A"', output=self.outfile)
+        self.assertModule(t_list)
+        self.assertFileExists(self.outfile)
+        with open(self.outfile, 'r') as f:
+            read_data = f.read()
+        for a, b in zip(list_string.split("\n"), read_data.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        #self.assertLooksLike(reference=read_data, actual=list_string)
+        if os.path.isfile(self.outfile):
+            os.remove(self.outfile)
+
     def test_trast_list(self):
         self.runModule("g.mapset", mapset="test3d1")
 
@@ -97,8 +112,6 @@
                                 a2|test3d2|2001-03-01 00:00:00|2001-05-01 00:00:00
                                 a3|test3d2|2001-05-01 00:00:00|2001-07-01 00:00:00"""
 
-        entries = list_string.split("\n")
-
         trast_list = SimpleModule(
             "t.rast3d.list", quiet=True, flags="s", input="A at test3d2")
         self.assertModule(trast_list)
@@ -112,8 +125,6 @@
                                 a2|test3d3|2001-04-01 00:00:00|2001-07-01 00:00:00
                                 a3|test3d3|2001-07-01 00:00:00|2001-10-01 00:00:00"""
 
-        entries = list_string.split("\n")
-
         trast_list = SimpleModule(
             "t.rast3d.list", quiet=True, flags="s", input="A at test3d3")
         self.assertModule(trast_list)
@@ -136,6 +147,17 @@
         for a, b in zip(list_string.split("\n"), out.split("\n")):
             self.assertEqual(a.strip(), b.strip())
 
+        trast_list = SimpleModule("t.rast3d.list", quiet=True, flags="s",
+                                  input="A at test3d4", output=self.outfile)
+        self.assertModule(trast_list)
+        self.assertFileExists(self.outfile)
+        with open(self.outfile, 'r') as f:
+            read_data = f.read()
+        for a, b in zip(list_string.split("\n"), read_data.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        if os.path.isfile(self.outfile):
+            os.remove(self.outfile)
+
     def test_strds_info(self):
         self.runModule("g.mapset", mapset="test3d4")
         tinfo_string = """id=A at test3d1

Modified: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py
===================================================================
--- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py	2016-02-18 10:33:00 UTC (rev 67877)
+++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py	2016-02-18 10:40:26 UTC (rev 67878)
@@ -17,6 +17,7 @@
 class TestRasterExtraction(TestCase):
 
     mapsets_to_remove = []
+    outfile = 'vectlist.txt'
 
     @classmethod
     def setUpClass(cls):
@@ -76,6 +77,20 @@
         for a, b in zip(list_string.split("\n"), out.split("\n")):
             self.assertEqual(a.strip(), b.strip())
 
+        t_list = SimpleModule(
+            "t.list", quiet=True,
+            columns=["name", "mapset,start_time", "end_time", "number_of_maps"],
+            type="stvds", where='name = "A"', output=self.outfile)
+        self.assertModule(t_list)
+        self.assertFileExists(self.outfile)
+        with open(self.outfile, 'r') as f:
+            read_data = f.read()
+        for a, b in zip(list_string.split("\n"), read_data.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        #self.assertLooksLike(reference=read_data, actual=list_string)
+        if os.path.isfile(self.outfile):
+            os.remove(self.outfile)
+
     def test_tvect_list(self):
         self.runModule("g.mapset", mapset="testvect1")
 
@@ -139,6 +154,18 @@
         for a, b in zip(list_string.split("\n"), out.split("\n")):
             self.assertEqual(a.strip(), b.strip())
 
+        trast_list = SimpleModule("t.vect.list", quiet=True, flags="s",
+                                  columns=["name", "mapset", "start_time", "end_time"],
+                                  input="A at testvect4", output=self.outfile)
+        self.assertModule(trast_list)
+        self.assertFileExists(self.outfile)
+        with open(self.outfile, 'r') as f:
+            read_data = f.read()
+        for a, b in zip(list_string.split("\n"), read_data.split("\n")):
+            self.assertEqual(a.strip(), b.strip())
+        if os.path.isfile(self.outfile):
+            os.remove(self.outfile)
+
     def test_stvds_info(self):
         self.runModule("g.mapset", mapset="testvect4")
         tinfo_string = """id=A at testvect1



More information about the grass-commit mailing list