[GRASS-SVN] r65950 - grass/trunk/lib/python/pygrass/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 17 22:19:07 PDT 2015


Author: zarch
Date: 2015-08-17 22:19:07 -0700 (Mon, 17 Aug 2015)
New Revision: 65950

Modified:
   grass/trunk/lib/python/pygrass/gis/__init__.py
Log:
pygrass: fix doctests, now they are not dependent by mapset name

Modified: grass/trunk/lib/python/pygrass/gis/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/gis/__init__.py	2015-08-18 05:17:38 UTC (rev 65949)
+++ grass/trunk/lib/python/pygrass/gis/__init__.py	2015-08-18 05:19:07 UTC (rev 65950)
@@ -229,8 +229,8 @@
         ::
 
             >>> location = Location()
-            >>> sorted(location.mapsets())
-            ['PERMANENT', 'user1']
+            >>> sorted(location.mapsets())                # doctest: +ELLIPSIS
+            [...]
 
         """
         mapsets = [mapset for mapset in self]
@@ -249,15 +249,17 @@
 class Mapset(object):
     """Mapset ::
 
+        >>> from grass.script.core import gisenv
+        >>> genv = gisenv()
         >>> mapset = Mapset()
-        >>> mapset
-        Mapset('user1')
-        >>> mapset.gisdbase                               # doctest: +ELLIPSIS
-        '/home/...'
-        >>> mapset.location
-        'nc_basic_spm_grass7'
-        >>> mapset.name
-        'user1'
+        >>> mapset                                        # doctest: +ELLIPSIS
+        Mapset(...)
+        >>> mapset.gisdbase == genv['GISDBASE']
+        True
+        >>> mapset.location == genv['LOCATION_NAME']
+        True
+        >>> mapset.name == genv['MAPSET']
+        True
 
     ..
     """
@@ -318,11 +320,11 @@
         ::
 
             >>> mapset = Mapset('PERMANENT')
-            >>> rast = mapset.glist('rast')
+            >>> rast = mapset.glist('raster')
             >>> rast.sort()
             >>> rast                                      # doctest: +ELLIPSIS
             ['basins', 'elevation', ...]
-            >>> sorted(mapset.glist('rast', pattern='el*'))
+            >>> sorted(mapset.glist('raster', pattern='el*'))
             ['elevation', 'elevation_shade']
 
         ..
@@ -367,8 +369,8 @@
     """VisibleMapset object::
 
         >>> mapset = VisibleMapset('user1')
-        >>> mapset
-        ['user1', 'PERMANENT']
+        >>> mapset                                       # doctest: +ELLIPSIS
+        [...]
 
     ..
     """



More information about the grass-commit mailing list