Skip to content
Permalink
Browse files

[processing] Don't use authid to compare layer CRSes

Instead of QgsCoordinateReferenceSystem == operator, so that we
can correctly test equality of non-standard CRSes
  • Loading branch information
nyalldawson committed Jan 11, 2021
1 parent f8e5e0b commit 7478bca68d07ef17ad9814ca0090daa2387d6e60
Showing with 12 additions and 3 deletions.
  1. +12 −3 python/testing/__init__.py
@@ -29,7 +29,13 @@
import tempfile

from qgis.PyQt.QtCore import QVariant
from qgis.core import QgsApplication, QgsFeatureRequest, NULL
from qgis.core import (
QgsApplication,
QgsFeatureRequest,
QgsCoordinateReferenceSystem,
NULL
)

import unittest

# Get a backup, we will patch this one later
@@ -86,9 +92,12 @@ def checkLayersEqual(self, layer_expected, layer_result, use_asserts=False, **kw

# Compare CRS
if 'ignore_crs_check' not in compare or not compare['ignore_crs_check']:
expected_wkt = layer_expected.dataProvider().crs().toWkt(QgsCoordinateReferenceSystem.WKT_PREFERRED)
result_wkt = layer_result.dataProvider().crs().toWkt(QgsCoordinateReferenceSystem.WKT_PREFERRED)

if use_asserts:
_TestCase.assertEqual(self, layer_expected.dataProvider().crs().authid(), layer_result.dataProvider().crs().authid())
elif not layer_expected.dataProvider().crs().authid() == layer_result.dataProvider().crs().authid():
_TestCase.assertEqual(self, layer_expected.dataProvider().crs(), layer_result.dataProvider().crs())
elif layer_expected.dataProvider().crs() != layer_result.dataProvider().crs():
return False

# Compare features

0 comments on commit 7478bca

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