Skip to content

Commit

Permalink
Make test layer comparison handle different order of features
Browse files Browse the repository at this point in the history
(cherry-picked from f449bf2)
  • Loading branch information
nyalldawson committed Aug 9, 2016
1 parent c232d65 commit 644cbd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/testing/__init__.py
Expand Up @@ -73,7 +73,10 @@ def assertLayersEqual(self, layer_expected, layer_result, **kwargs):
except KeyError:
precision = 14

for feats in zip(layer_expected.getFeatures(request), layer_result.getFeatures(request)):
expected_features = sorted(layer_expected.getFeatures(request), key=lambda f: f.id())
result_features = sorted(layer_expected.getFeatures(request), key=lambda f: f.id())

for feats in zip(expected_features, result_features):
if feats[0].geometry() is not None:
geom0 = feats[0].geometry().geometry().asWkt(precision)
else:
Expand Down

0 comments on commit 644cbd9

Please sign in to comment.