فهرست منبع

fix doctest for gis/__init__.py

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54919 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 12 سال پیش
والد
کامیت
dd2a421fc6
1فایلهای تغییر یافته به همراه13 افزوده شده و 9 حذف شده
  1. 13 9
      lib/python/pygrass/gis/__init__.py

+ 13 - 9
lib/python/pygrass/gis/__init__.py

@@ -62,10 +62,10 @@ def _check(value, path, type):
 class Gisdbase(object):
     """Return Gisdbase object. ::
 
+        >>> from grass.script.core import gisenv
         >>> gisdbase = Gisdbase()
-        >>> gisdbase.name          # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
-        '/home/...'
-
+        >>> gisdbase.name == gisenv()['GISDBASE']
+        True
 
     """
     def __init__(self, gisdbase=''):
@@ -88,9 +88,12 @@ class Gisdbase(object):
     def __getitem__(self, location):
         """Return a Location object. ::
 
+            >>> from grass.script.core import gisenv
+            >>> loc_env = gisenv()['LOCATION_NAME']
             >>> gisdbase = Gisdbase()
-            >>> gisdbase['nc_basic_spm_grass7']
-            Location('nc_basic_spm_grass7')
+            >>> loc_py = gisdbase[loc_env]
+            >>> loc_env == loc_py.name
+            True
 
         ..
         """
@@ -127,13 +130,14 @@ class Gisdbase(object):
 class Location(object):
     """Location object ::
 
+        >>> from grass.script.core import gisenv
         >>> location = Location()
         >>> location                                      # doctest: +ELLIPSIS
         Location(...)
-        >>> location.gisdbase                              # doctest: +ELLIPSIS
-        '/home/...'
-        >>> location.name
-        'nc_basic_spm_grass7'
+        >>> location.gisdbase == gisenv()['GISDBASE']
+        True
+        >>> location.name == gisenv()['LOCATION_NAME']
+        True
     """
     def __init__(self, location='', gisdbase=''):
         self.gisdbase = gisdbase