Browse Source

pygrass: Fix doctest.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61879 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 10 years ago
parent
commit
936a720b80
1 changed files with 10 additions and 12 deletions
  1. 10 12
      lib/python/pygrass/raster/category.py

+ 10 - 12
lib/python/pygrass/raster/category.py

@@ -53,19 +53,17 @@ class Category(list):
 
     >>> import grass.lib.raster as libraster
     >>> import ctypes
-    >>> import grass.pygrass as pygrass
-    >>> land = pygrass.raster.RasterRow('geology')
-    >>> cats = pygrass.raster.Category()
-    >>> cats.read(land) # or with cats.read(land.name, land.mapset, land.mtype)
-    >>> cats.labels()
-    ['pond', 'forest', 'developed', 'bare', 'paved road', 'dirt road',
-        'vineyard', 'agriculture', 'wetland', 'bare ground path', 'grass']
-    >>> min_cat = ctypes.c_void_p()
-    >>> max_cat = ctypes.c_void_p()
-    >>> libraster.Rast_get_ith_c_cat(ctypes.byref(cats.cats), 0,
-    ...                              min_cat, max_cat)
+    >>> from grass.pygrass.raster.category import Category
+    >>> cats = Category('landuse')
+    >>> cats.read()
+    >>> cats.labels()                                     # doctest: +ELLIPSIS
+    ['undefined', 'developed', 'agriculture', ..., 'water', 'sediment']
+    >>> cats[0]
+    ('undefined', 0, None)
+    >>> cats[1]
+    ('developed', 1, None)
     """
-    def __init__(self, name, mapset='', mtype=None, *args, **kargs):
+    def __init__(self, name, mapset='', mtype='CELL', *args, **kargs):
         self.name = name
         self.mapset = mapset
         self.c_cats = libraster.Categories()