[GRASS-SVN] r73598 - in grass/branches/releasebranch_7_6/lib/python: gunittest pygrass/gis pygrass/modules pygrass/modules/grid pygrass/modules/interface pygrass/raster temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 22 14:04:04 PDT 2018


Author: neteler
Date: 2018-10-22 14:04:04 -0700 (Mon, 22 Oct 2018)
New Revision: 73598

Modified:
   grass/branches/releasebranch_7_6/lib/python/gunittest/gmodules.py
   grass/branches/releasebranch_7_6/lib/python/pygrass/gis/__init__.py
   grass/branches/releasebranch_7_6/lib/python/pygrass/modules/grid/grid.py
   grass/branches/releasebranch_7_6/lib/python/pygrass/modules/interface/module.py
   grass/branches/releasebranch_7_6/lib/python/pygrass/modules/shortcuts.py
   grass/branches/releasebranch_7_6/lib/python/pygrass/raster/__init__.py
   grass/branches/releasebranch_7_6/lib/python/temporal/base.py
   grass/branches/releasebranch_7_6/lib/python/temporal/c_libraries_interface.py
   grass/branches/releasebranch_7_6/lib/python/temporal/temporal_extent.py
Log:
pygrass library, temporal framework: Fixed doctests (bundle backport, trunk r73579:r73587)

Modified: grass/branches/releasebranch_7_6/lib/python/gunittest/gmodules.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/gunittest/gmodules.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/gunittest/gmodules.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -39,7 +39,7 @@
     >>> str(colors.outputs.stdout)
     ''
     >>> colors.outputs.stderr.strip()
-    "Color table for raster map <test_a> set to 'rules'"
+    u"Color table for raster map <test_a> set to 'rules'"
     """
     def __init__(self, cmd, *args, **kargs):
         for banned in ['stdout_', 'stderr_', 'finish_', 'run_']:

Modified: grass/branches/releasebranch_7_6/lib/python/pygrass/gis/__init__.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/pygrass/gis/__init__.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/pygrass/gis/__init__.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -14,6 +14,9 @@
 from grass.pygrass.errors import GrassError
 from grass.script.utils import encode, decode
 
+test_vector_name = "Gis_test_vector"
+test_raster_name = "Gis_test_raster"
+
 libgis.G_gisinit('')
 
 
@@ -466,9 +469,6 @@
     from grass.pygrass import utils
     from grass.script.core import run_command
 
-    test_vector_name = "Gis_test_vector"
-    test_raster_name = "Gis_test_raster"
-
     utils.create_test_vector_map(test_vector_name)
     run_command("g.region", n=50, s=0, e=60, w=0, res=1)
     run_command("r.mapcalc", expression="%s = 1" % (test_raster_name),

Modified: grass/branches/releasebranch_7_6/lib/python/pygrass/modules/grid/grid.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/pygrass/modules/grid/grid.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/pygrass/modules/grid/grid.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -83,7 +83,7 @@
     >>> sorted(os.listdir(path))                          # doctest: +ELLIPSIS
     [...'PERMANENT'...]
     >>> sorted(os.listdir(os.path.join(path, 'PERMANENT')))
-    [u'DEFAULT_WIND', u'PROJ_INFO', u'PROJ_UNITS', u'VAR', u'WIND']
+    [u'DEFAULT_WIND', u'PROJ_EPSG', u'PROJ_INFO', u'PROJ_UNITS', u'VAR', u'WIND']
     >>> sorted(os.listdir(os.path.join(path, mname)))   # doctest: +ELLIPSIS
     [...u'SEARCH_PATH',...u'WIND']
     >>> import shutil

Modified: grass/branches/releasebranch_7_6/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/pygrass/modules/interface/module.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/pygrass/modules/interface/module.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -394,7 +394,7 @@
     >>> colors.outputs["stdout"].value
     u''
     >>> colors.outputs["stderr"].value.strip()
-    "Color table for raster map <test_a> set to 'rules'"
+    u"Color table for raster map <test_a> set to 'rules'"
 
     >>> colors = Module("r.colors", map="test_a", rules="-",
     ...                 run_=False, finish_=False, stdin_=PIPE)

Modified: grass/branches/releasebranch_7_6/lib/python/pygrass/modules/shortcuts.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/pygrass/modules/shortcuts.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/pygrass/modules/shortcuts.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -26,7 +26,7 @@
        >>> g_list.run()
        Module('g.list')
        >>> g_list.outputs.stdout                         # doctest: +ELLIPSIS
-       '...basin...soils...'
+       u'...basin...elevation...'
        >>> r = MetaModule('r')
        >>> what = r.what
        >>> what.description

Modified: grass/branches/releasebranch_7_6/lib/python/pygrass/raster/__init__.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/pygrass/raster/__init__.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/pygrass/raster/__init__.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -99,27 +99,27 @@
         to interact with the raster categories.
 
         >>> elev.cats          # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
-        [('A', 11, None),
-         ('B', 12, None),
+        [(u'A', 11, None),
+         (u'B', 12, None),
         ...
-         ('P', 44, None)]
+         (u'P', 44, None)]
 
         >>> elev.cats.labels() # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
-        ['A', 'B', 'C', 'D', 'E',
-         'F', 'G', 'H', 'I', 'J',
-         'K', 'L', 'M', 'n', 'O', 'P']
+        [u'A', u'B', u'C', u'D', u'E',
+         u'F', u'G', u'H', u'I', u'J',
+         u'K', u'L', u'M', u'n', u'O', u'P']
         >>> elev.cats[0]
-        ('A', 11, None)
+        (u'A', 11, None)
         >>> elev.cats[2]
-        ('C', 13, None)
+        (u'C', 13, None)
         >>> elev.cats[0] = ('AA', 11)
         >>> elev.cats[1] = ('BB', 12)
         >>> elev.cats.write()
         >>> elev.cats.read()
         >>> elev.cats[0]
-        ('AA', 11, None)
+        (u'AA', 11, None)
         >>> elev.cats[1]
-        ('BB', 12, None)
+        (u'BB', 12, None)
 
         Open a raster map using the *with statement*:
 

Modified: grass/branches/releasebranch_7_6/lib/python/temporal/base.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/temporal/base.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/temporal/base.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -563,7 +563,7 @@
             mapset=PERMANENT
             creator=soeren
             temporal_type=absolute
-            creation_time=2001-01-01 00:00:00
+            creation_time='2001-01-01 00:00:00'
 
     """
 
@@ -860,8 +860,8 @@
         mapset=PERMANENT
         creator=soeren
         temporal_type=absolute
-        creation_time=2001-01-01 00:00:00
-        modification_time=2001-01-01 00:00:00
+        creation_time='2001-01-01 00:00:00'
+        modification_time='2001-01-01 00:00:00'
         semantic_type=average
 
     """

Modified: grass/branches/releasebranch_7_6/lib/python/temporal/c_libraries_interface.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/temporal/c_libraries_interface.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/temporal/c_libraries_interface.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -1075,7 +1075,7 @@
            >>> kvp['area']
            0
            >>> kvp['lines']
-           10
+           0
            >>> kvp['line']
            0
            >>> 'columns' in kvp

Modified: grass/branches/releasebranch_7_6/lib/python/temporal/temporal_extent.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/temporal/temporal_extent.py	2018-10-22 20:59:53 UTC (rev 73597)
+++ grass/branches/releasebranch_7_6/lib/python/temporal/temporal_extent.py	2018-10-22 21:04:04 UTC (rev 73598)
@@ -58,8 +58,8 @@
          | Start time:................. 2001-01-01 00:00:00
          | End time:................... 2005-01-01 00:00:00
         >>> A.print_shell_info()
-        start_time=2001-01-01 00:00:00
-        end_time=2005-01-01 00:00:00
+        start_time='2001-01-01 00:00:00'
+        end_time='2005-01-01 00:00:00'
         >>> # relative time
         >>> A = TemporalExtent(table="raster_absolute_time",
         ... ident="soil at PERMANENT", start_time=0, end_time=1 )
@@ -73,8 +73,8 @@
          | Start time:................. 0
          | End time:................... 1
         >>> A.print_shell_info()
-        start_time=0
-        end_time=1
+        start_time='0'
+        end_time='1'
 
     """
     def __init__(self, table=None, ident=None, start_time=None, end_time=None):
@@ -1119,9 +1119,9 @@
              | Granularity:................ 1 days
              | Temporal type of maps:...... interval
             >>> A.print_shell_info()
-            start_time=2001-01-01 00:00:00
-            end_time=2005-01-01 00:00:00
-            granularity=1 days
+            start_time='2001-01-01 00:00:00'
+            end_time='2005-01-01 00:00:00'
+            granularity='1 days'
             map_time=interval
 
     """
@@ -1243,8 +1243,8 @@
              | End time:................... 1
              | Relative time unit:......... years
             >>> A.print_shell_info()
-            start_time=0
-            end_time=1
+            start_time='0'
+            end_time='1'
             unit=years
 
     """
@@ -1367,8 +1367,8 @@
              | Granularity:................ 5
              | Temporal type of maps:...... interval
             >>> A.print_shell_info()
-            start_time=0
-            end_time=1
+            start_time='0'
+            end_time='1'
             unit=years
             granularity=5
             map_time=interval



More information about the grass-commit mailing list