[Thuban-commits] r2696 - in trunk/thuban: . test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Sep 18 01:19:22 CEST 2006
Author: bernhard
Date: 2006-09-18 01:19:21 +0200 (Mon, 18 Sep 2006)
New Revision: 2696
Modified:
trunk/thuban/ChangeLog
trunk/thuban/test/test_proj.py
Log:
test/test_proj.py: new test_lc_numeric_robustness()
Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog 2006-09-15 14:09:17 UTC (rev 2695)
+++ trunk/thuban/ChangeLog 2006-09-17 23:19:21 UTC (rev 2696)
@@ -1,3 +1,6 @@
+2006-09-18 Bernhard Reiter <bernhard at intevation.de>
+ * test/test_proj.py: new test_lc_numeric_robustness()
+
2006-09-15 Bernhard Reiter <bernhard at intevation.de>
* README: added RXP and pyRXP as optional for tests.
Modified: trunk/thuban/test/test_proj.py
===================================================================
--- trunk/thuban/test/test_proj.py 2006-09-15 14:09:17 UTC (rev 2695)
+++ trunk/thuban/test/test_proj.py 2006-09-17 23:19:21 UTC (rev 2696)
@@ -14,8 +14,10 @@
# $Id$
import unittest
+import locale
import os
+import localessupport
import xmlsupport
import support
support.initthuban()
@@ -96,6 +98,31 @@
"ellps=clrk66"])
self.assertEquals(proj.GetProjectedUnits(), PROJ_UNITS_DEGREES)
+ def test_lc_numeric_robustness(self):
+ """Test if an LC_NUMERIC local with comma as decimal_point will work.
+
+ Some versions of proj are not robust against this.
+ Starting with Python 2.4 there is a different behaviour when
+ calling C extensions and now they will see changes locales settings
+ which might tickle the bug in proj.
+ """
+ params = ["proj=latlong", "to_meter=0.01745", "ellps=clrk66"]
+
+ oldlocale = localessupport.setdecimalcommalocale()
+ if oldlocale == None:
+ raise support.SkipTest(
+ "No locale with comma as decimal_point found.")
+
+ proj = Projection(params)
+ result1 = proj.Forward(1,1)
+
+ locale.setlocale(locale.LC_NUMERIC, "C")
+ proj = Projection(params)
+ result2= proj.Forward(1,1)
+
+ locale.setlocale(locale.LC_NUMERIC, oldlocale)
+ self.assertFloatSeqEqual(result1, result2, epsilon = 1e-5 )
+
def test_get_projection_units_normal(self):
"""Test Projection.GetProjectedUnits() for normal projection"""
proj = Projection(["zone=26", "proj=utm", "ellps=clrk66"])
More information about the Thuban-commits
mailing list