Skip to content
Permalink
Browse files

tests: make compareWkt more tolerant towards whitespaces

  • Loading branch information
jef-n committed Feb 28, 2014
1 parent 4a8f627 commit ab105599bb4706a18e0148e81577eef519e4749b
Showing with 5 additions and 5 deletions.
  1. +1 −1 tests/src/python/test_qgsgeometry.py
  2. +4 −4 tests/src/python/utilities.py
@@ -911,7 +911,7 @@ def testDeleteVertex(self):
polygon = QgsGeometry.fromWkt("POLYGON((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))")

assert polygon.deleteVertex(2), "Delete vertex 2 failed"
print "FIXME: exportToWkt doesn't put a blanks behind the comma"
print "FIXME: exportToWkt doesn't put a blank behind the comma"
expwkt = "POLYGON((0 0,1 0,2 1,2 2,0 2,0 0))"
wkt = polygon.exportToWkt()
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )
@@ -47,7 +47,6 @@
PARENT = None
IFACE = None
GEOCRS = 4326 # constant for EPSG:GEOCRS Geographic CRS id
GOOGLECRS = 900913 # constant for EPSG:GOOGLECRS Google Mercator id

FONTSLOADED = False

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


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

# compare the structure
a0 = r.sub( "#", a )
b0 = r.sub( "#", b )
a0 = r1.sub( ",", r0.sub( "#", r ) )

This comment has been minimized.

Copy link
@3nids

3nids Feb 28, 2014

Member

isn't this supposed to be
a0 = r1.sub( ",", r0.sub( "#", a) ) ?

b0 = r1.sub( ",", r0.sub( "#", b ) )
if a0 != b0:
return False

0 comments on commit ab10559

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