Skip to content

Commit 8ce2530

Browse files
committed
Fix tests for QGIS 3.34+
1 parent 1da0e79 commit 8ce2530

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/test_feature.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
from qgis.core import QgsVectorLayer
3+
from qgis.core import Qgis, QgsVectorLayer
44
from qgis.PyQt.QtCore import NULL, QDate, QDateTime, QVariant
55

66
LOGGER = logging.getLogger('server')
@@ -15,7 +15,7 @@
1515
def _test_list(list_a, list_b):
1616
assert len(list_a) == len(list_b)
1717
for item in list_a:
18-
assert item in list_b
18+
assert item in list_b, list_a
1919

2020

2121
def _test_vector_layer(file_path, storage, provider='ogr', count=4) -> QgsVectorLayer:
@@ -41,8 +41,11 @@ def test_getfeature_gml(client):
4141
assert rv.status_code == 200
4242
assert 'text/xml' in rv.headers.get('Content-Type'), rv.headers
4343
layer = _test_vector_layer(rv.file('gml'), 'GML')
44-
_test_list(
45-
layer.fields().names(), ['gml_id', 'id', 'trailing_zero', 'name', 'comment', 'date_time', 'date'])
44+
expected_fields = ['gml_id']
45+
if Qgis.versionInt() >= 33400:
46+
expected_fields.extend(['lowerCorner', 'upperCorner'])
47+
expected_fields.extend(['id', 'trailing_zero', 'name', 'comment', 'date_time', 'date'])
48+
_test_list(layer.fields().names(), expected_fields)
4649

4750
index = layer.fields().indexFromName('gml_id')
4851
assert layer.uniqueValues(index) == {'lines.1', 'lines.2', 'lines.3', 'lines.4'}

0 commit comments

Comments
 (0)