Skip to content
Permalink
Browse files

Avoid key error on fields which should be skipped

  • Loading branch information
nyalldawson committed Dec 7, 2016
1 parent c975764 commit 1bdb35d63044c24df406d0b7b9b888f84642e705
Showing with 3 additions and 2 deletions.
  1. +3 −2 python/testing/__init__.py
@@ -102,8 +102,6 @@ def assertLayersEqual(self, layer_expected, layer_result, **kwargs):
)

for attr_expected, field_expected in zip(feats[0].attributes(), layer_expected.fields().toList()):
attr_result = feats[1][field_expected.name()]
field_result = [fld for fld in layer_expected.fields().toList() if fld.name() == field_expected.name()][0]
try:
cmp = compare['fields'][field_expected.name()]
except KeyError:
@@ -116,6 +114,9 @@ def assertLayersEqual(self, layer_expected, layer_result, **kwargs):
if 'skip' in cmp:
continue

attr_result = feats[1][field_expected.name()]
field_result = [fld for fld in layer_expected.fields().toList() if fld.name() == field_expected.name()][0]

# Cast field to a given type
if 'cast' in cmp:
if cmp['cast'] == 'int':

0 comments on commit 1bdb35d

Please sign in to comment.
You can’t perform that action at this time.