Skip to content
Permalink
Browse files

Fix test

  • Loading branch information
m-kuhn committed Jul 2, 2018
1 parent a1b6a2c commit 3c03da28c0b9ab5344b51ce3ef185fe38efbd19e
Showing with 5 additions and 2 deletions.
  1. +5 −2 tests/src/python/test_qgsexpression.py
@@ -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):
@@ -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")

0 comments on commit 3c03da2

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