Skip to content

Commit ab10559

Browse files
committedFeb 28, 2014
tests: make compareWkt more tolerant towards whitespaces
1 parent 4a8f627 commit ab10559

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎tests/src/python/test_qgsgeometry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ def testDeleteVertex(self):
911911
polygon = QgsGeometry.fromWkt("POLYGON((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))")
912912

913913
assert polygon.deleteVertex(2), "Delete vertex 2 failed"
914-
print "FIXME: exportToWkt doesn't put a blanks behind the comma"
914+
print "FIXME: exportToWkt doesn't put a blank behind the comma"
915915
expwkt = "POLYGON((0 0,1 0,2 1,2 2,0 2,0 0))"
916916
wkt = polygon.exportToWkt()
917917
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )

‎tests/src/python/utilities.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
PARENT = None
4848
IFACE = None
4949
GEOCRS = 4326 # constant for EPSG:GEOCRS Geographic CRS id
50-
GOOGLECRS = 900913 # constant for EPSG:GOOGLECRS Google Mercator id
5150

5251
FONTSLOADED = False
5352

@@ -201,11 +200,12 @@ def writeShape(theMemoryLayer, theFileName):
201200

202201

203202
def compareWkt(a, b, tol=0.000001):
204-
r = re.compile( "-?\d+(?:\.\d+)?(?:[eE]\d+)?" )
203+
r0 = re.compile( "-?\d+(?:\.\d+)?(?:[eE]\d+)?" )
204+
r1 = re.compile( "\s*,\s*" )
205205

206206
# compare the structure
207-
a0 = r.sub( "#", a )
208-
b0 = r.sub( "#", b )
207+
a0 = r1.sub( ",", r0.sub( "#", r ) )
Code has comments. Press enter to view.
208+
b0 = r1.sub( ",", r0.sub( "#", b ) )
209209
if a0 != b0:
210210
return False
211211

0 commit comments

Comments
 (0)
Please sign in to comment.