Skip to content
Permalink
Browse files

[afs] Ensure that null attributes are correctly mapped for PyQGIS

  • Loading branch information
nyalldawson committed Feb 20, 2018
1 parent 7d620e2 commit 7711f1335a7010c3d4170f856a4b6521bb1d3c98
Showing with 6 additions and 1 deletion.
  1. +5 −0 src/providers/arcgisrest/qgsafsshareddata.cpp
  2. +1 −1 tests/src/python/providertestbase.py
@@ -96,6 +96,11 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, const QgsRect
foreach ( int idx, fetchAttribIdx )
{
QVariant attribute = attributesData[mFields.at( idx ).name()];
if ( attribute.isNull() )
{
// ensure that null values are mapped correctly for PyQGIS
attribute = QVariant( QVariant::Int );
}
mFields.at( idx ).convertCompatible( attribute );
attributes[idx] = attribute;
if ( mFields.at( idx ).name() == QStringLiteral( "OBJECTID" ) )
@@ -331,7 +331,7 @@ def testExtent(self):

def testUnique(self):
self.assertEqual(set(self.source.uniqueValues(self.source.fields().lookupField('cnt'))), set([-200, 100, 200, 300, 400]))
assert set(['Apple', 'Honey', 'Orange', 'Pear', NULL]) == set(self.source.uniqueValues(2)), 'Got {}'.format(set(self.source.uniqueValues(self.source.fields().lookupField('name'))))
assert set(['Apple', 'Honey', 'Orange', 'Pear', NULL]) == set(self.source.uniqueValues(self.source.fields().lookupField('name'))), 'Got {}'.format(set(self.source.uniqueValues(self.source.fields().lookupField('name'))))

if self.source.supportsSubsetString():
subset = self.getSubsetString2()

0 comments on commit 7711f13

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