Skip to content

Commit b6194aa

Browse files
committed
Add test to check if QgsFeature.setAttributes handles 0 vs NULL correctly
1 parent 8300521 commit b6194aa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/src/python/test_qgsfeature.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
import qgis
1616
import os
1717

18-
from qgis.core import QgsFeature, QgsGeometry, QgsPoint, QgsVectorLayer
18+
from qgis.core import QgsFeature, QgsGeometry, QgsPoint, QgsVectorLayer, NULL
1919
from utilities import (unitTestDataPath,
2020
getQgisTestApp,
2121
TestCase,
2222
unittest
2323
)
24+
from unittest import expectedFailure
25+
2426
QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
2527

2628

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

6971
assert myAttributes == myExpectedAttributes, myMessage
7072

73+
@expectedFailure
74+
def test_SetAttribute(self):
75+
feat = QgsFeature()
76+
feat.initAttributes(1)
77+
feat.setAttributes([0])
78+
feat.setAttributes([NULL])
79+
assert [NULL] == feat.attributes()
80+
7181
def test_DeleteAttribute(self):
7282
feat = QgsFeature()
7383
feat.initAttributes(3)

0 commit comments

Comments
 (0)