Author: cito
Date: Sun Nov 22 13:19:02 2015
New Revision: 604

Log:
Allow for several variations of the locale names

Modified:
   trunk/module/TEST_PyGreSQL_classic_connection.py

Modified: trunk/module/TEST_PyGreSQL_classic_connection.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_connection.py    Sun Nov 22 11:26:34 
2015        (r603)
+++ trunk/module/TEST_PyGreSQL_classic_connection.py    Sun Nov 22 13:19:02 
2015        (r604)
@@ -1002,7 +1002,16 @@
         # check that money values can be interpreted correctly
         # if and only if the decimal point is set appropriately
         # for the current lc_monetary setting
-        query("set lc_monetary='en_US.UTF-8'")
+        # first try with English localization (using the point)
+        for lc in 'en', 'en_US', 'en_US.utf8', 'en_US.UTF-8':
+            try:
+                query("set lc_monetary='%s'" % lc)
+            except pg.ProgrammingError:
+                pass
+            else:
+                break
+        else:
+            self.fail("Cannot set English money locale")
         pg.set_decimal_point('.')
         r = query("select '34.25'::money").getresult()[0][0]
         self.assertIsInstance(r, d)
@@ -1010,7 +1019,16 @@
         pg.set_decimal_point(',')
         r = query("select '34.25'::money").getresult()[0][0]
         self.assertNotEqual(r, d('34.25'))
-        query("set lc_monetary='de_DE.UTF-8'")
+        # first try with German localization (using the comma)
+        for lc in 'de', 'de_DE', 'de_DE.utf8', 'de_DE.UTF-8':
+            try:
+                query("set lc_monetary='%s'" % lc)
+            except pg.ProgrammingError:
+                pass
+            else:
+                break
+        else:
+            self.fail("Cannot set English money locale")
         pg.set_decimal_point(',')
         r = query("select '34,25'::money").getresult()[0][0]
         self.assertIsInstance(r, d)
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to