Thread: [SQL-CVS] r1206 - SQLObject/trunk/sqlobject/tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-11-03 16:27:59
|
Author: phd Date: 2005-11-03 16:27:43 +0000 (Thu, 03 Nov 2005) New Revision: 1206 Modified: SQLObject/trunk/sqlobject/tests/test_decimal.py Log: A little patch for psycopg2 by Humberto Diogenes <adm...@di...>. Modified: SQLObject/trunk/sqlobject/tests/test_decimal.py =================================================================== --- SQLObject/trunk/sqlobject/tests/test_decimal.py 2005-11-03 12:30:45 UTC (rev 1205) +++ SQLObject/trunk/sqlobject/tests/test_decimal.py 2005-11-03 16:27:43 UTC (rev 1206) @@ -13,18 +13,23 @@ class DecimalTable(SQLObject): col1 = DecimalCol(size=6, precision=4) -def test_1decimal(): - if not supports('decimalColumn'): - return - setupClass(DecimalTable) - d = DecimalTable(col1=21.12) - assert d.col1 == 21.12 - -if Decimal and supports('decimalColumn'): - def test_2Decimal(): +if supports('decimalColumn'): + def test_1decimal(): + """Tests new instance with a float in col1.""" setupClass(DecimalTable) - d = DecimalTable(col1=Decimal("21.12")) - if isinstance(d.col1, Decimal): + d = DecimalTable(col1=21.12) + # psycopg2 returns float as Decimal + if Decimal and isinstance(d.col1, Decimal): assert d.col1 == Decimal("21.12") else: assert d.col1 == 21.12 + + if Decimal: + def test_2Decimal(): + """Tests new instance with a Decimal in col1.""" + setupClass(DecimalTable) + d = DecimalTable(col1=Decimal("21.12")) + if isinstance(d.col1, Decimal): + assert d.col1 == Decimal("21.12") + else: + assert d.col1 == 21.12 |