]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Corrected issue with decimal e notation that broke regular decimal tests for mssql.
authorMichael Trier <mtrier@gmail.com>
Mon, 10 Nov 2008 01:11:43 +0000 (01:11 +0000)
committerMichael Trier <mtrier@gmail.com>
Mon, 10 Nov 2008 01:11:43 +0000 (01:11 +0000)
lib/sqlalchemy/databases/mssql.py
test/sql/testtypes.py

index 923e85ceabc2c5d3e2ad5d9a6beb3c62c69755a6..b254941ab2aa7956734bbc8cf813d8513ec13680 100644 (file)
@@ -69,7 +69,7 @@ class MSNumeric(sqltypes.Numeric):
                 # Not sure that this exception is needed
                 return value
             else:
-                if value._exp < 6:
+                if not isinstance(value, float) and value._exp < -6:
                     value = ((value < 0 and '-' or '')
                         + '0.'
                         + '0' * -(value._exp+1)
index 457deb44ed2c4a373a4abdf553f993c3e5ce2935..d1e12d2cd59618ab6b6f0c2700b71422bcebc142 100644 (file)
@@ -708,10 +708,10 @@ class NumericTest(TestBase, AssertsExecutionResults):
             (l[0][0], l[0][1], round(l[0][2], 5), l[0][3], l[0][4]),
             (l[1][0], l[1][1], round(l[1][2], 5), l[1][3], l[1][4]),
         ]
-        assert rounded == [
+        testing.eq_(rounded, [
             (1, 3.5, 5.6, Decimal("12.4"), Decimal("15.75")),
             (2, 3.5, 5.6, Decimal("12.4"), Decimal("15.75")),
-        ]
+        ])
 
     def test_decimal_fallback(self):
         from decimal import Decimal