File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -433,6 +433,26 @@ def testEmpty(self):
433
433
self .source .setSubsetString (None )
434
434
self .assertFalse (self .source .empty ())
435
435
436
+ # If the provider supports tests on editable layers
437
+ if getattr (self , 'getEditableLayer' , None ):
438
+ l = self .getEditableLayer ()
439
+ self .assertTrue (l .isValid ())
440
+
441
+ self .assertEqual (l .hasFeatures (), QgsFeatureSource .FeaturesAvailable )
442
+
443
+ # Test that deleting some features in the edit buffer does not
444
+ # return empty, we accept FeaturesAvailable as well as
445
+ # MaybeAvailable
446
+ l .startEditing ()
447
+ l .deleteFeature (next (l .getFeatures ()).id ())
448
+ self .assertNotEqual (l .hasFeatures (), QgsFeatureSource .NoFeaturesAvailable )
449
+ l .rollBack ()
450
+
451
+ # Call truncate(), we need an empty set now
452
+ l .dataProvider ().truncate ()
453
+ self .assertTrue (l .dataProvider ().empty ())
454
+ self .assertEqual (l .dataProvider ().hasFeatures (), QgsFeatureSource .NoFeaturesAvailable )
455
+
436
456
def testGetFeaturesNoGeometry (self ):
437
457
""" Test that no geometry is present when fetching features without geometry"""
438
458
You can’t perform that action at this time.
0 commit comments