Skip to content

Commit 40e2845

Browse files
committedMay 23, 2015
Add some comments to provider test suite
1 parent c1b520f commit 40e2845

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed
 

‎tests/src/python/providertestbase.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@
1313
__revision__ = '$Format:%H$'
1414

1515
from qgis.core import QgsRectangle, QgsFeatureRequest, QgsGeometry, NULL
16-
from utilities import TestCase
17-
1816

1917
class ProviderTestCase(object):
18+
'''
19+
This is a collection of tests for vector data providers and kept generic.
20+
To make use of it, subclass it and set self.provider to a provider you want to test.
21+
Make sure that your provider uses the default dataset by converting one of the provided datasets from the folder
22+
tests/testdata/provider to a dataset your provider is able to handle.
23+
24+
To test expression compilation, add the methods `enableCompiler()` and `disableCompiler()` to your subclass.
25+
If these methods are present, the tests will ensure that the result of server side and client side expression
26+
evaluation are equal.
27+
'''
2028
def runGetFeatureTests(self, provider):
2129
assert len([f for f in provider.getFeatures()]) == 5
2230
assert len([f for f in provider.getFeatures(QgsFeatureRequest().setFilterExpression('name IS NOT NULL'))]) == 4
@@ -62,7 +70,7 @@ def testMaxValue(self):
6270

6371
def testExtent(self):
6472
reference = QgsGeometry.fromRect(
65-
QgsRectangle(-71.1230000000000047, 66.3299999999999983, -65.3199999999999932, 78.2999999999999972))
73+
QgsRectangle(-71.123, 66.33, -65.32, 78.3))
6674
provider_extent = QgsGeometry.fromRect(self.provider.extent())
6775

6876
assert QgsGeometry.compare(provider_extent.asPolygon(), reference.asPolygon(), 0.000001)

0 commit comments

Comments
 (0)
Please sign in to comment.