Author: cito
Date: Fri Nov 27 08:10:58 2015
New Revision: 644

Log:
Make tests compatible with Python 2.6

Modified:
   branches/4.x/module/tests/__init__.py
   branches/4.x/module/tests/test_classic_connection.py
   branches/4.x/module/tests/test_classic_dbwrapper.py
   trunk/module/tests/__init__.py
   trunk/module/tests/test_classic_connection.py
   trunk/module/tests/test_classic_dbwrapper.py

Modified: branches/4.x/module/tests/__init__.py
==============================================================================
--- branches/4.x/module/tests/__init__.py       Fri Nov 27 07:56:09 2015        
(r643)
+++ branches/4.x/module/tests/__init__.py       Fri Nov 27 08:10:58 2015        
(r644)
@@ -4,7 +4,10 @@
 
 """
 
-import unittest
+try:
+    import unittest2 as unittest  # for Python < 2.7
+except ImportError:
+    import unittest
 
 
 def discover():

Modified: branches/4.x/module/tests/test_classic_connection.py
==============================================================================
--- branches/4.x/module/tests/test_classic_connection.py        Fri Nov 27 
07:56:09 2015        (r643)
+++ branches/4.x/module/tests/test_classic_connection.py        Fri Nov 27 
08:10:58 2015        (r644)
@@ -978,8 +978,8 @@
         # only if decimal_point is set, and that the result is correct
         # only if it is set suitable for the current lc_monetary setting
         select_money = "select '34.25'::money"
-        proper_money = d(34.25)
-        bad_money = d(3425)
+        proper_money = d('34.25')
+        bad_money = d('3425')
         en_locales = 'en', 'en_US', 'en_US.utf8', 'en_US.UTF-8'
         en_money = '$34.25', '$ 34.25', '34.25$', '34.25 $', '34.25 Dollar'
         de_locales = 'de', 'de_DE', 'de_DE.utf8', 'de_DE.UTF-8'

Modified: branches/4.x/module/tests/test_classic_dbwrapper.py
==============================================================================
--- branches/4.x/module/tests/test_classic_dbwrapper.py Fri Nov 27 07:56:09 
2015        (r643)
+++ branches/4.x/module/tests/test_classic_dbwrapper.py Fri Nov 27 08:10:58 
2015        (r644)
@@ -707,7 +707,8 @@
                 dict(d=Decimal(0)), (dict(d=0), dict(d=Decimal(0))),
                 dict(f4=None, f8=None), dict(f4=0, f8=0),
                 (dict(f4='', f8=''), dict(f4=None, f8=None)),
-                dict(d=1234.5, f4=1234.5, f8=1234.5),
+                (dict(d=1234.5, f4=1234.5, f8=1234.5),
+                      dict(d=Decimal('1234.5'))),
                 dict(d=Decimal('123.456789'), f4=12.375, f8=123.4921875),
                 dict(d=Decimal('123456789.9876543212345678987654321')),
                 dict(m=None), (dict(m=''), dict(m=None)),

Modified: trunk/module/tests/__init__.py
==============================================================================
--- trunk/module/tests/__init__.py      Fri Nov 27 07:56:09 2015        (r643)
+++ trunk/module/tests/__init__.py      Fri Nov 27 08:10:58 2015        (r644)
@@ -4,7 +4,10 @@
 
 """
 
-import unittest
+try:
+    import unittest2 as unittest  # for Python < 2.7
+except ImportError:
+    import unittest
 
 
 def discover():

Modified: trunk/module/tests/test_classic_connection.py
==============================================================================
--- trunk/module/tests/test_classic_connection.py       Fri Nov 27 07:56:09 
2015        (r643)
+++ trunk/module/tests/test_classic_connection.py       Fri Nov 27 08:10:58 
2015        (r644)
@@ -1344,8 +1344,8 @@
         # only if decimal_point is set, and that the result is correct
         # only if it is set suitable for the current lc_monetary setting
         select_money = "select '34.25'::money"
-        proper_money = d(34.25)
-        bad_money = d(3425)
+        proper_money = d('34.25')
+        bad_money = d('3425')
         en_locales = 'en', 'en_US', 'en_US.utf8', 'en_US.UTF-8'
         en_money = '$34.25', '$ 34.25', '34.25$', '34.25 $', '34.25 Dollar'
         de_locales = 'de', 'de_DE', 'de_DE.utf8', 'de_DE.UTF-8'

Modified: trunk/module/tests/test_classic_dbwrapper.py
==============================================================================
--- trunk/module/tests/test_classic_dbwrapper.py        Fri Nov 27 07:56:09 
2015        (r643)
+++ trunk/module/tests/test_classic_dbwrapper.py        Fri Nov 27 08:10:58 
2015        (r644)
@@ -781,7 +781,8 @@
                 dict(d=Decimal(0)), (dict(d=0), dict(d=Decimal(0))),
                 dict(f4=None, f8=None), dict(f4=0, f8=0),
                 (dict(f4='', f8=''), dict(f4=None, f8=None)),
-                dict(d=1234.5, f4=1234.5, f8=1234.5),
+                (dict(d=1234.5, f4=1234.5, f8=1234.5),
+                      dict(d=Decimal('1234.5'))),
                 dict(d=Decimal('123.456789'), f4=12.375, f8=123.4921875),
                 dict(d=Decimal('123456789.9876543212345678987654321')),
                 dict(m=None), (dict(m=''), dict(m=None)),
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to