[GRASS-SVN] r54919 - grass/trunk/lib/python/pygrass/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Feb 5 03:02:47 PST 2013
Author: lucadelu
Date: 2013-02-05 03:02:47 -0800 (Tue, 05 Feb 2013)
New Revision: 54919
Modified:
grass/trunk/lib/python/pygrass/gis/__init__.py
Log:
fix doctest for gis/__init__.py
Modified: grass/trunk/lib/python/pygrass/gis/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/gis/__init__.py 2013-02-05 10:55:21 UTC (rev 54918)
+++ grass/trunk/lib/python/pygrass/gis/__init__.py 2013-02-05 11:02:47 UTC (rev 54919)
@@ -62,11 +62,11 @@
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=''):
self.name = gisdbase
@@ -88,9 +88,12 @@
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 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
More information about the grass-commit
mailing list