Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gunittest.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
exclude =
gui/wxpython/core/testsuite/toolboxes.sh
python/grass/gunittest/testsuite/test_gunitest_doctests.py
python/grass/pygrass/raster/testsuite/test_pygrass_raster_doctests.py
python/grass/pygrass/rpc/testsuite/test_pygrass_rpc_doctests.py
python/grass/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py
python/grass/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py
Expand Down
68 changes: 34 additions & 34 deletions python/grass/pygrass/raster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ class RasterRow(RasterAbstractBase):

>>> with RasterRow(test_raster_name) as elev:
... for row in elev:
... row
Buffer([11, 21, 31, 41], dtype=int32)
Buffer([12, 22, 32, 42], dtype=int32)
Buffer([13, 23, 33, 43], dtype=int32)
Buffer([14, 24, 34, 44], dtype=int32)
... row # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([11, 21, 31, 41]...)
Buffer([12, 22, 32, 42]...)
Buffer([13, 23, 33, 43]...)
Buffer([14, 24, 34, 44]...)

>>> elev.is_open()
False
Expand All @@ -146,10 +146,10 @@ def get_row(self, row, row_buffer=None):

>>> elev = RasterRow(test_raster_name)
>>> elev.open()
>>> elev[0]
Buffer([11, 21, 31, 41], dtype=int32)
>>> elev.get_row(0)
Buffer([11, 21, 31, 41], dtype=int32)
>>> elev[0] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([11, 21, 31, 41]...)
>>> elev.get_row(0) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([11, 21, 31, 41]...)

"""
if row_buffer is None:
Expand Down Expand Up @@ -270,11 +270,11 @@ def get_row(self, row, row_buffer=None):
>>> elev = RasterRowIO(test_raster_name)
>>> elev.open("r")
>>> for row in elev:
... row
Buffer([11, 21, 31, 41], dtype=int32)
Buffer([12, 22, 32, 42], dtype=int32)
Buffer([13, 23, 33, 43], dtype=int32)
Buffer([14, 24, 34, 44], dtype=int32)
... row # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([11, 21, 31, 41]...)
Buffer([12, 22, 32, 42]...)
Buffer([13, 23, 33, 43]...)
Buffer([14, 24, 34, 44]...)

>>> elev.close()

Expand Down Expand Up @@ -367,22 +367,22 @@ def get_row(self, row, row_buffer=None):
>>> elev = RasterRowIO(test_raster_name)
>>> elev.open("r")
>>> for row in elev:
... row
Buffer([11, 21, 31, 41], dtype=int32)
Buffer([12, 22, 32, 42], dtype=int32)
Buffer([13, 23, 33, 43], dtype=int32)
Buffer([14, 24, 34, 44], dtype=int32)
... row # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([11, 21, 31, 41]...)
Buffer([12, 22, 32, 42]...)
Buffer([13, 23, 33, 43]...)
Buffer([14, 24, 34, 44]...)

>>> elev.close()


>>> with RasterSegment(test_raster_name) as elev:
... for row in elev:
... row
Buffer([11, 21, 31, 41], dtype=int32)
Buffer([12, 22, 32, 42], dtype=int32)
Buffer([13, 23, 33, 43], dtype=int32)
Buffer([14, 24, 34, 44], dtype=int32)
... row # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([11, 21, 31, 41]...)
Buffer([12, 22, 32, 42]...)
Buffer([13, 23, 33, 43]...)
Buffer([14, 24, 34, 44]...)

"""
if row_buffer is None:
Expand Down Expand Up @@ -410,11 +410,11 @@ def put_row(self, row, row_buffer):
>>> map_b = RasterSegment(test_raster_name + "_segment")
>>> map_b.open("r")
>>> for row in map_b:
... row
Buffer([1011, 1021, 1031, 1041], dtype=int32)
Buffer([1012, 1022, 1032, 1042], dtype=int32)
Buffer([1013, 1023, 1033, 1043], dtype=int32)
Buffer([1014, 1024, 1034, 1044], dtype=int32)
... row # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([1011, 1021, 1031, 1041]...)
Buffer([1012, 1022, 1032, 1042]...)
Buffer([1013, 1023, 1033, 1043]...)
Buffer([1014, 1024, 1034, 1044]...)
>>> map_b.close()

"""
Expand Down Expand Up @@ -479,11 +479,11 @@ def put(self, row, col, val):
>>> map_b = RasterSegment(test_raster_name + "_segment")
>>> map_b.open("r")
>>> for row in map_b:
... row
Buffer([111., 121., 131., 141.], dtype=float32)
Buffer([112., 122., 132., 142.], dtype=float32)
Buffer([113., 123., 133., 143.], dtype=float32)
Buffer([114., 124., 134., 144.], dtype=float32)
... row # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Buffer([111., 121., 131., 141.]...)
Buffer([112., 122., 132., 142.]...)
Buffer([113., 123., 133., 143.]...)
Buffer([114., 124., 134., 144.]...)
>>> map_b.close()

"""
Expand Down
2 changes: 1 addition & 1 deletion python/grass/pygrass/raster/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def mtype(self):
if self.dtype in FCELL:
return "FCELL"
if self.dtype in DCELL:
return DCELL
return "DCELL"
Comment thread
Khansa435 marked this conversation as resolved.
err = "Raster type: %r not supported by GRASS."
raise TypeError(err % self.dtype)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,16 @@ def load_tests(loader, tests, ignore):
overwrite=True,
)

tests.addTests(doctest.DocTestSuite(pgrass))
tests.addTests(doctest.DocTestSuite(pgrass.abstract))
tests.addTests(
doctest.DocTestSuite(
pgrass, optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE
)
)
tests.addTests(
doctest.DocTestSuite(
pgrass.abstract, optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE
)
)
return tests


Expand Down
12 changes: 6 additions & 6 deletions python/grass/pygrass/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ def get_raster_for_points(poi_vector, raster, column=None, region=None):
Sample the raster layer at the given points, return a list of values

>>> l = get_raster_for_points(vect, ele, region=region)
>>> l[0] # doctest: +ELLIPSIS
(1, 10.0, 6.0, 1)
>>> l[1] # doctest: +ELLIPSIS
(2, 12.0, 6.0, 1)
>>> l[0] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
(1, 10.0, 6.0, ...)
>>> l[1] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
(2, 12.0, 6.0, ...)

Add a new column and sample again

Expand All @@ -295,9 +295,9 @@ def get_raster_for_points(poi_vector, raster, column=None, region=None):
Filters('SELECT value, Utils_test_raster FROM test_vect_2;')
>>> cur = vect.table.execute()
>>> r = cur.fetchall()
>>> r[0] # doctest: +ELLIPSIS
>>> r[0] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
(10.0, 1.0)
>>> r[1] # doctest: +ELLIPSIS
>>> r[1] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
(12.0, 1.0)
>>> vect.close()
>>> remove("test_vect_2", "vect")
Expand Down
Loading