From 97a8d1a7a2d3e0f917ca052d5a432219b23c4a04 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 14 Aug 2017 02:55:41 +1000 Subject: [PATCH] Fix failing test --- .../algs/gdal/ogr2ogrpointsonlines.py | 28 +++++++------------ .../tests/testdata/gdal_algorithm_tests.yaml | 4 +-- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/python/plugins/processing/algs/gdal/ogr2ogrpointsonlines.py b/python/plugins/processing/algs/gdal/ogr2ogrpointsonlines.py index 9cff0062aa5..425011e60e8 100644 --- a/python/plugins/processing/algs/gdal/ogr2ogrpointsonlines.py +++ b/python/plugins/processing/algs/gdal/ogr2ogrpointsonlines.py @@ -31,26 +31,19 @@ from qgis.core import (QgsProcessingParameterFeatureSource, QgsProcessingParameterNumber, QgsProcessingParameterVectorDestination, QgsProcessingOutputVectorLayer, - QgsProcessing, - QgsVectorFileWriter, - QgsVectorLayer) -from processing.core.parameters import ParameterVector -from processing.core.parameters import ParameterString -from processing.core.parameters import ParameterNumber -from processing.core.outputs import OutputVector + QgsProcessing) from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm from processing.algs.gdal.GdalUtils import GdalUtils -from processing.tools import dataobjects from processing.tools.system import isWindows -from processing.tools.vector import ogrConnectionString, ogrLayerName +from processing.tools.vector import ogrConnectionString class Ogr2OgrPointsOnLines(GdalAlgorithm): - OUTPUT_LAYER = 'OUTPUT_LAYER' - INPUT_LAYER = 'INPUT_LAYER' + OUTPUT = 'OUTPUT' + INPUT = 'INPUT' DISTANCE = 'DISTANCE' GEOMETRY = 'GEOMETRY' OPTIONS = 'OPTIONS' @@ -59,7 +52,7 @@ class Ogr2OgrPointsOnLines(GdalAlgorithm): super().__init__() def initAlgorithm(self, config=None): - self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER, + self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.tr('Input layer'), [QgsProcessing.TypeVectorLine], optional=False)) self.addParameter(QgsProcessingParameterString(self.GEOMETRY, self.tr('Geometry column name ("geometry" for Shapefiles, may be different for other formats)'), @@ -70,8 +63,7 @@ class Ogr2OgrPointsOnLines(GdalAlgorithm): self.tr('Additional creation options (see ogr2ogr manual)'), defaultValue='', optional=True)) - self.addParameter(QgsProcessingParameterVectorDestination(self.OUTPUT_LAYER, self.tr('Points along lines'), QgsProcessing.TypeVectorPoint)) - self.addOutput(QgsProcessingOutputVectorLayer(self.OUTPUT_LAYER, self.tr("Points along lines"), QgsProcessing.TypeVectorPoint)) + self.addParameter(QgsProcessingParameterVectorDestination(self.OUTPUT, self.tr('Points along lines'), QgsProcessing.TypeVectorPoint)) def name(self): return 'createpointsalonglines' @@ -83,15 +75,15 @@ class Ogr2OgrPointsOnLines(GdalAlgorithm): return self.tr('Vector geoprocessing') def getConsoleCommands(self, parameters, context, feedback): - ogrLayer, layername = self.getOgrCompatibleSource(self.INPUT_LAYER, parameters, context, feedback) + ogrLayer, layername = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback) distance = str(self.parameterAsDouble(parameters, self.DISTANCE, context)) - geometry = str(self.parameterAsString(parameters, self.GEOMETRY, context)) + geometry = self.parameterAsString(parameters, self.GEOMETRY, context) - outFile = self.parameterAsOutputLayer(parameters, self.OUTPUT_LAYER, context) + outFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context) output = ogrConnectionString(outFile, context) - options = str(self.parameterAsString(parameters, self.OPTIONS, context)) + options = self.parameterAsString(parameters, self.OPTIONS, context) arguments = [] arguments.append(output) diff --git a/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml b/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml index 95a6859a33c..456ae0da2dd 100644 --- a/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml +++ b/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml @@ -95,11 +95,11 @@ tests: params: DISTANCE: 0.25 GEOMETRY: geometry - INPUT_LAYER: + INPUT: name: lines.gml type: vector results: - OUTPUT_LAYER: + OUTPUT: name: expected/gdal/points_along_lines.gml type: vector