Skip to content
Permalink
Browse files

Add test to check if QgsFeature.setAttributes handles 0 vs NULL corre…

…ctly
  • Loading branch information
m-kuhn committed Jul 10, 2015
1 parent 8300521 commit b6194aa349338c57cfc5987a661905c7c134083a
Showing with 11 additions and 1 deletion.
  1. +11 −1 tests/src/python/test_qgsfeature.py
@@ -15,12 +15,14 @@
import qgis
import os

from qgis.core import QgsFeature, QgsGeometry, QgsPoint, QgsVectorLayer
from qgis.core import QgsFeature, QgsGeometry, QgsPoint, QgsVectorLayer, NULL
from utilities import (unitTestDataPath,
getQgisTestApp,
TestCase,
unittest
)
from unittest import expectedFailure

QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()


@@ -68,6 +70,14 @@ def test_Attributes(self):

assert myAttributes == myExpectedAttributes, myMessage

@expectedFailure
def test_SetAttribute(self):
feat = QgsFeature()
feat.initAttributes(1)
feat.setAttributes([0])
feat.setAttributes([NULL])
assert [NULL] == feat.attributes()

def test_DeleteAttribute(self):
feat = QgsFeature()
feat.initAttributes(3)

0 comments on commit b6194aa

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