Changeset 644


Ignore:
Timestamp:
Nov 27, 2015, 8:10:58 AM (4 years ago)
Author:
cito
Message:

Make tests compatible with Python 2.6

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/4.x/module/tests/__init__.py

    r640 r644  
    55"""
    66
    7 import unittest
     7try:
     8    import unittest2 as unittest  # for Python < 2.7
     9except ImportError:
     10    import unittest
    811
    912
  • branches/4.x/module/tests/test_classic_connection.py

    r643 r644  
    979979        # only if it is set suitable for the current lc_monetary setting
    980980        select_money = "select '34.25'::money"
    981         proper_money = d(34.25)
    982         bad_money = d(3425)
     981        proper_money = d('34.25')
     982        bad_money = d('3425')
    983983        en_locales = 'en', 'en_US', 'en_US.utf8', 'en_US.UTF-8'
    984984        en_money = '$34.25', '$ 34.25', '34.25$', '34.25 $', '34.25 Dollar'
  • branches/4.x/module/tests/test_classic_dbwrapper.py

    r641 r644  
    708708                dict(f4=None, f8=None), dict(f4=0, f8=0),
    709709                (dict(f4='', f8=''), dict(f4=None, f8=None)),
    710                 dict(d=1234.5, f4=1234.5, f8=1234.5),
     710                (dict(d=1234.5, f4=1234.5, f8=1234.5),
     711                      dict(d=Decimal('1234.5'))),
    711712                dict(d=Decimal('123.456789'), f4=12.375, f8=123.4921875),
    712713                dict(d=Decimal('123456789.9876543212345678987654321')),
  • trunk/module/tests/__init__.py

    r640 r644  
    55"""
    66
    7 import unittest
     7try:
     8    import unittest2 as unittest  # for Python < 2.7
     9except ImportError:
     10    import unittest
    811
    912
  • trunk/module/tests/test_classic_connection.py

    r643 r644  
    13451345        # only if it is set suitable for the current lc_monetary setting
    13461346        select_money = "select '34.25'::money"
    1347         proper_money = d(34.25)
    1348         bad_money = d(3425)
     1347        proper_money = d('34.25')
     1348        bad_money = d('3425')
    13491349        en_locales = 'en', 'en_US', 'en_US.utf8', 'en_US.UTF-8'
    13501350        en_money = '$34.25', '$ 34.25', '34.25$', '34.25 $', '34.25 Dollar'
  • trunk/module/tests/test_classic_dbwrapper.py

    r641 r644  
    782782                dict(f4=None, f8=None), dict(f4=0, f8=0),
    783783                (dict(f4='', f8=''), dict(f4=None, f8=None)),
    784                 dict(d=1234.5, f4=1234.5, f8=1234.5),
     784                (dict(d=1234.5, f4=1234.5, f8=1234.5),
     785                      dict(d=Decimal('1234.5'))),
    785786                dict(d=Decimal('123.456789'), f4=12.375, f8=123.4921875),
    786787                dict(d=Decimal('123456789.9876543212345678987654321')),
Note: See TracChangeset for help on using the changeset viewer.