Skip to content
Permalink
Browse files

Restore script based algorithm tests

  • Loading branch information
nyalldawson committed Jun 27, 2017
1 parent ae82985 commit e171fe30c0dbfe0571d5234ec2f38175746cf59b
@@ -2542,29 +2542,29 @@ tests:
# MIN_DISTANCE: 0.0
# POINT_NUMBER: 5
# results: {}
#
# - algorithm: script:selectbyattribute
# name: Select by attribute
# params:
# INPUT_LAYER:
# name: points.gml
# type: vector
# results:
# OUTPUT_LAYER:
# name: expected/selected_points.gml
# type: vector
#
# - algorithm: script:selectbyexpression
# name: Select by expression
# params:
# INPUT_LAYER:
# name: points.gml
# type: vector
# results:
# OUTPUT_LAYER:
# name: expected/select_by_expression.gml
# type: vector
#

- algorithm: script:selectbyattribute
name: Select by attribute
params:
INPUT_LAYER:
name: points.gml
type: vector
results:
OUTPUT_LAYER:
name: expected/selected_points.gml
type: vector

- algorithm: script:selectbyexpression
name: Select by expression
params:
INPUT_LAYER:
name: points.gml
type: vector
results:
OUTPUT_LAYER:
name: expected/select_by_expression.gml
type: vector

- algorithm: qgis:randomextract
name: Random extract by number
params:
@@ -1,16 +1,23 @@
##Select by attribute=name
##Tests=group

#inputs

##INPUT_LAYER=vector
##OUTPUT_LAYER=output vector
##OUTPUT_LAYER=vectorOut

#outputs

##OUTPUT_LAYER=output outputVector

import processing

result = processing.run("qgis:selectbyattribute",
INPUT_LAYER,
"id2",
0,
"2")

processing.run("qgis:saveselectedfeatures",
result["OUTPUT"],
OUTPUT_LAYER)
{'INPUT': INPUT_LAYER,
'FIELD': "id2",
'OPERATOR': 0,
'VALUE': "2"}, context=context, feedback=feedback)
result = processing.run("qgis:saveselectedfeatures",
{'INPUT': result["OUTPUT"],
'OUTPUT': parameters['OUTPUT_LAYER']}, context=context, feedback=feedback)
OUTPUT_LAYER = result['OUTPUT']
@@ -1,15 +1,25 @@
##Select by expression=name
##Tests=group

#inputs

##INPUT_LAYER=vector
##OUTPUT_LAYER=output vector
##OUTPUT_LAYER=vectorOut

#outputs

##OUTPUT_LAYER=output outputVector


import processing

result = processing.run("qgis:selectbyexpression",
INPUT_LAYER,
'"id2" = 0 and "id" > 7',
"1")
{'INPUT': INPUT_LAYER,
'EXPRESSION': '"id2" = 0 and "id" > 7',
'METHOD': 1}, context=context, feedback=feedback)

processing.run("qgis:saveselectedfeatures",
result["RESULT"],
OUTPUT_LAYER)
result = processing.run("qgis:saveselectedfeatures",
{'INPUT': result["OUTPUT"],
'OUTPUT': parameters['OUTPUT_LAYER']},
context=context, feedback=feedback)
OUTPUT_LAYER = result['OUTPUT']

0 comments on commit e171fe3

Please sign in to comment.
You can’t perform that action at this time.