Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ParameterExtent test #21

Open
wants to merge 4 commits into
base: processing-tests
Choose a base branch
from
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
Empty file added python/plugins/__init__.py
Empty file.
2 changes: 0 additions & 2 deletions python/plugins/processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
from processing.tools.vector import *
from processing.tools.raster import *
from processing.tools.system import *
from processing.tests.TestData import loadTestData


def classFactory(iface):
from processing.ProcessingPlugin import ProcessingPlugin
Expand Down
15 changes: 8 additions & 7 deletions tests/src/python/plugins/processing/ParametersTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@

__revision__ = '$Format:%H$'

from utilities import getQgisTestApp, unittest

QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()

from plugins.processing.core import parameters
from utilities import unittest

from plugins.processing.core.parameters import ParameterNumber
from plugins.processing.core.parameters import ParameterCrs
Expand Down Expand Up @@ -61,10 +57,15 @@ def testParameterExtent(self):
assert not param.setValue('0,2,0')
assert not param.setValue('0,2,0,a')
assert param.setValue('0,2,2,4')
assert param.value == '0,2,2,4'
self.assertEqual(param.value, '0,2,2,4')
assert param.setValue(None)
assert param.value == param.default, 'Result: {}, Expected: {}'.format(param.value, param.default)
self.assertEqual(param.value, None)

required = ParameterExtent('name', 'desc', optional=False)
first_value = '0,2,2,4'
assert required.setValue(first_value)
assert not required.setValue(None)
self.assertEqual(required.value, first_value)

def suite():
suite = unittest.makeSuite(ParametersTest, 'test')
Expand Down