Skip to content
Permalink
Browse files
Fix number
  • Loading branch information
rldhont authored and nyalldawson committed May 4, 2021
1 parent 44a5c97 commit 08947d7ba0f14cffa17841fceb07e63e36908d8b
Showing with 25 additions and 1 deletion.
  1. +25 −1 python/plugins/processing/tests/ParametersTest.py
@@ -24,7 +24,8 @@
import os
import shutil

from qgis.core import QgsProcessingParameterDefinition
from qgis.core import (QgsProcessingParameterDefinition,
QgsProcessingParameterNumber)
from qgis.testing import start_app, unittest

from processing.core.parameters import getParameterFromString
@@ -122,6 +123,29 @@ def testParameterNumberDesc(self):
self.assertIsNone(param.defaultValue())
self.assertTrue(param.flags() & QgsProcessingParameterDefinition.FlagOptional)

desc = 'QgsProcessingParameterNumber|in_number|Input number|QgsProcessingParameterNumber.Integer|10|False|0'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'number')
self.assertEqual(param.name(), 'in_number')
self.assertEqual(param.description(), 'Input Number')
self.assertEqual(param.dataType(), QgsProcessingParameterNumber.Integer)
self.assertEqual(param.defaultValue(), 10)
self.assertFalse(param.flags() & QgsProcessingParameterDefinition.FlagOptional)
self.assertEqual(param.minimum(), 0)

desc = 'QgsProcessingParameterNumber|in_number|Input number|QgsProcessingParameterNumber.Integer|10|False|0|20'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'number')
self.assertEqual(param.name(), 'in_number')
self.assertEqual(param.description(), 'Input Number')
self.assertEqual(param.dataType(), QgsProcessingParameterNumber.Integer)
self.assertEqual(param.defaultValue(), 10)
self.assertFalse(param.flags() & QgsProcessingParameterDefinition.FlagOptional)
self.assertEqual(param.minimum(), 0)
self.assertEqual(param.maximum(), 20)


if __name__ == '__main__':
unittest.main()

0 comments on commit 08947d7

Please sign in to comment.