Author: phd
Date: 2005-11-03 16:33:27 +0000 (Thu, 03 Nov 2005)
New Revision: 1207
Modified:
home/phd/SQLObject/paramstyles/sqlobject/tests/test_decimal.py
Log:
Merged patches from the revisions 1206:1206 from the trunk: a small patch for psycopg2 by Humberto Diogenes <adm...@di...>.
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_decimal.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_decimal.py 2005-11-03 16:27:43 UTC (rev 1206)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_decimal.py 2005-11-03 16:33:27 UTC (rev 1207)
@@ -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
|