Skip to content

Commit

Permalink
Add new test data and a bunch of unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Médéric RIBREUX committed Jun 12, 2016
1 parent 9011bec commit bb94a17
Show file tree
Hide file tree
Showing 19 changed files with 982 additions and 75 deletions.
37 changes: 24 additions & 13 deletions python/plugins/processing/gui/TestTools.py
Expand Up @@ -54,6 +54,7 @@
ParameterMultipleInput,
ParameterFile,
ParameterString,
ParameterNumber,
ParameterBoolean
)

Expand All @@ -77,7 +78,7 @@ def extractSchemaPath(filepath):
path = filepath
part = True

while part:
while part and filepath:
(path, part) = os.path.split(path)
if part == 'testdata' and not localpath:
localparts = parts
Expand Down Expand Up @@ -111,6 +112,14 @@ def parseParameters(command):
result = m.group(2)
separator = m.group(3)

# Handle special values:
if result == 'None':
result = None
elif result.lower() == unicode(True).lower():
result = True
elif result.lower() == unicode(False).lower():
result = False

yield result

if not separator:
Expand Down Expand Up @@ -139,6 +148,9 @@ def createTest(text):

i += 1
token = tokens[i]
# Handle empty parameters that are optionals
if param.optional and token is None:
continue

if isinstance(param, ParameterVector):
schema, filepath = extractSchemaPath(token)
Expand Down Expand Up @@ -198,19 +210,18 @@ def createTest(text):
elif isinstance(param, ParameterString):
params[param.name] = token
elif isinstance(param, ParameterBoolean):
params[param.name] = token == 'True'
else:
try:
params[param.name] = token
elif isinstance(param, ParameterNumber):
if param.isInteger:
params[param.name] = int(token)
except ValueError:
try:
params[param.name] = float(token)
except ValueError:
if token[0] == '"':
token = token[1:]
if token[-1] == '"':
token = token[:-1]
params[param.name] = token
else:
params[param.name] = float(token)
else:
if token[0] == '"':
token = token[1:]
if token[-1] == '"':
token = token[:-1]
params[param.name] = token

definition['params'] = params

Expand Down
84 changes: 23 additions & 61 deletions python/plugins/processing/tests/grass7_todo.md
Expand Up @@ -3,15 +3,9 @@
## Raster algorithms

* r.basins.fill
* r.blend.combine
* r.blend.rgb
* r.buffer
* r.buffer.lowmem
* r.carve
* r.carve: needs a vector input
* r.category
* r.category.out
* r.circle
* r.clump
* r.coin
* r.colors
* r.colors.out
Expand Down Expand Up @@ -92,15 +86,13 @@
* r.out.vrml
* r.param.scale
* r.patch
* r.plane
* r.profile
* r.quant
* r.quantile
* r.random
* r.random.cells
* r.random.raster
* r.random.surface
* r.reclass
* r.reclass.area.greater
* r.reclass.area.lesser
* r.recode
Expand All @@ -118,58 +110,28 @@
* r.rescale
* r.rescale.eq
* r.rgb
* r.ros
* r.series
* r.series.accumulate
* r.series.interp
* r.shade
* r.sim.sediment
* r.sim.water
* r.slope (il y en a 2)
* r.slope.aspect
* r.solute.transport
* r.spread
* r.spreadpath
* r.statistics
* r.stats
* r.stats.quantile.out
* r.stats.quantile.rast
* r.stream.extract
* r.sum
* r.sun
* r.sunhours
* r.sunmask.datetime
* r.sunmask.position
* r.support
* r.surf.area
* r.surf.contour
* r.surf.fractal
* r.surf.gauss
* r.surf.idw
* r.surf.random
* r.terraflow
* r.texture
* r.thin
* r.tile
* r.tileset
* r.to.vect
* r.topidx
* r.topmodel
* r.topmodel.topidxstats
* r.transect
* r.univar
* r.uslek
* r.usler
* r.viewshed
* r.volume
* r.walk.coords
* r.walk.points
* r.walk.rast
* r.water.outlet
* r.watershed
* r.what.color
* r.what.coords
* r.what.points
* r.ros: too much input rasters !
* r.series.accumulate: can't reproduce same results !
* r.series.interp: needs to handle output directories
* r.sim.sediment: too much input rasters !
* r.sim.water: too much input rasters !
* r.solute.transport: too much input rasters !
* r.spreadpath: segfaults with test dataset !
* r.stats.quantile.rast: needs to handle output directories
* r.sunhours: can't reproduce same results !
* r.support: create a new test for raster: test after metadata.
* r.surf.fractal: random results !
* r.surf.gauss: random results !
* r.surf.random: random results !
* r.terraflow: can't produce output with test dataset !
* r.texture: needs to handle output directories
* r.tile: needs to handle output directories
* r.tileset: can't reproduce same results
* r.to.vect: needs a vector output in GML
* r.topmodel: too much manual inputs.
* r.uslek: can't produce output with test dataset (needs reclassified float rasters) !
* r.viewshed: can't produce output with test dataset !
* r.volume: needs a vector output in GML

## Imagery algorithms

Expand Down
Binary file not shown.
@@ -0,0 +1 @@
PROJCS["RGF93_Lambert_93",GEOGCS["GCS_RGF93",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["Meter",1]]
@@ -0,0 +1 @@
PROJCS["RGF93 / Lambert-93",GEOGCS["RGF93",DATUM["Reseau_Geodesique_Francais_1993",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6171"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4171"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","2154"]]
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,30 @@
1:0:16.666667:30.166667
1:1:33.333333:363.333333
1:2:50.000000:696.500000
1:3:66.666667:1029.666667
1:4:83.333333:1362.833333
2:0:16.666667:1899.666667
2:1:33.333333:2002.666667
2:2:50.000000:2156.000000
2:3:66.666667:2309.333333
2:4:83.333333:2462.666667
3:0:16.666667:2967.666667
3:1:33.333333:3319.333333
3:2:50.000000:3671.000000
3:3:66.666667:4022.666667
3:4:83.333333:4374.333333
4:0:16.666667:5561.000000
4:1:33.333333:5729.333333
4:2:50.000000:6231.000000
4:3:66.666667:6732.666667
4:4:83.333333:7234.333333
5:0:16.666667:8062.666667
5:1:33.333333:8389.333333
5:2:50.000000:8716.000000
5:3:66.666667:9042.666667
5:4:83.333333:9369.333333
6:0:16.666667:10529.500000
6:1:33.333333:11363.000000
6:2:50.000000:12613.000000
6:3:66.666667:13030.000000
6:4:83.333333:6931.500000

0 comments on commit bb94a17

Please sign in to comment.