"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/src/python/test_provider_virtual.py" between
QGIS-final-3_10_11.tar.gz and QGIS-final-3_10_12.tar.gz

About: QGIS (Quantum GIS) is a Geographic Information System that supports vector, raster, and database formats. Long-term release (3.10.x series).

test_provider_virtual.py  (QGIS-final-3_10_11):test_provider_virtual.py  (QGIS-final-3_10_12)
skipping to change at line 1208 skipping to change at line 1208
df.setQuery('select error') df.setQuery('select error')
vl = QgsVectorLayer(df.toString(), "testq", "virtual") vl = QgsVectorLayer(df.toString(), "testq", "virtual")
self.assertEqual(vl.isValid(), False) self.assertEqual(vl.isValid(), False)
self.assertEqual(vl.featureCount(), 0) self.assertEqual(vl.featureCount(), 0)
ids = [f.id() for f in vl.getFeatures()] ids = [f.id() for f in vl.getFeatures()]
self.assertEqual(len(ids), 0) self.assertEqual(len(ids), 0)
QgsProject.instance().removeMapLayer(l1.id()) QgsProject.instance().removeMapLayer(l1.id())
def test_bool_fields(self):
ml = QgsVectorLayer("NoGeometry?field=a:int&field=b:boolean", "mem", "me
mory")
self.assertEqual(ml.isValid(), True)
QgsProject.instance().addMapLayer(ml)
ml.startEditing()
f1 = QgsFeature(ml.fields())
f1.setAttribute('a', 1)
f1.setAttribute('b', True)
f2 = QgsFeature(ml.fields())
f2.setAttribute('a', 2)
f2.setAttribute('b', False)
ml.addFeatures([f1, f2])
ml.commitChanges()
self.assertEqual([(f['a'], f['b']) for f in ml.getFeatures()], [(1, True
), (2, False)])
df = QgsVirtualLayerDefinition()
df.setQuery('select * from mem')
vl = QgsVectorLayer(df.toString(), "testq", "virtual")
self.assertEqual([(f['a'], f['b']) for f in vl.getFeatures()], [(1, True
), (2, False)])
df = QgsVirtualLayerDefinition()
df.setQuery('select * from mem where b')
vl = QgsVectorLayer(df.toString(), "testq", "virtual")
self.assertEqual([(f['a'], f['b']) for f in vl.getFeatures()], [(1, True
)])
df = QgsVirtualLayerDefinition()
df.setQuery('select * from mem where not b')
vl = QgsVectorLayer(df.toString(), "testq", "virtual")
self.assertEqual([(f['a'], f['b']) for f in vl.getFeatures()], [(2, Fals
e)])
QgsProject.instance().removeMapLayer(ml.id())
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
 End of changes. 1 change blocks. 
0 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)