Skip to content
Permalink
Browse files
add test for type handling in QgsExpression::createFieldEqualityExpre…
…ssion
  • Loading branch information
3nids committed Nov 8, 2021
1 parent ac2df24 commit 295a2e9e40cfe663ff353a229d4a5aa75a7d461e
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/src/python/test_qgsexpression.py
@@ -271,6 +271,20 @@ def testCreateFieldEqualityExpression(self):
res = '"my\'field" = TRUE'
self.assertEqual(e.createFieldEqualityExpression(field, value), res)

# test with field type
field = "myfield"
value = 1
type = QVariant.String
res = '"myfield" = \'1\''
self.assertEqual(e.createFieldEqualityExpression(field, value, type), res)

# test with field type
field = "myfield"
value = "1"
type = QVariant.Int
res = '"myfield" = 1'
self.assertEqual(e.createFieldEqualityExpression(field, value, type), res)

def testReferencedAttributeIndexesNonExistingField(self):
e = QgsExpression()
e.setExpression("foo = 1")

0 comments on commit 295a2e9

Please sign in to comment.