mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
[afs] Ensure that null attributes are correctly mapped for PyQGIS
This commit is contained in:
parent
7d620e28f1
commit
7711f1335a
@ -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 @@ class ProviderTestCase(FeatureSourceTestCase):
|
||||
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user