Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix test
  • Loading branch information
m-kuhn committed Jul 2, 2018
1 parent a1b6a2c commit 3c03da2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/src/python/test_qgsexpression.py
Expand Up @@ -17,7 +17,7 @@
from qgis.PyQt.QtCore import QVariant
from qgis.testing import unittest
from qgis.utils import qgsfunction
from qgis.core import QgsExpression, QgsFeatureRequest
from qgis.core import QgsExpression, QgsFeatureRequest, QgsExpressionContext, NULL


class TestQgsExpressionCustomFunctions(unittest.TestCase):
Expand Down Expand Up @@ -167,9 +167,12 @@ def testReferencedColumnsSet(self):
self.assertEqual(set(exp.referencedColumns()), set(['a', 'b']))

def testHandlesNull(self):
context = QgsExpressionContext()
QgsExpression.registerFunction(self.null_mean)
exp = QgsExpression('null_mean(1, 2, NULL, 3)')
self.assertEqual(set(exp.evaluate()), 2)
result = exp.evaluate(context)
self.assertFalse(exp.hasEvalError())
self.assertEqual(result, 2)

def testCantOverrideBuiltinsWithUnregister(self):
success = QgsExpression.unregisterFunction("sqrt")
Expand Down

0 comments on commit 3c03da2

Please sign in to comment.