From d360fd7fe33bdc7f3c0fc9c41a52c17f440b9310 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Mon, 10 Nov 2008 01:11:43 +0000 Subject: [PATCH] Corrected issue with decimal e notation that broke regular decimal tests for mssql. --- lib/sqlalchemy/databases/mssql.py | 2 +- test/sql/testtypes.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 923e85ceab..b254941ab2 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -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) diff --git a/test/sql/testtypes.py b/test/sql/testtypes.py index 457deb44ed..d1e12d2cd5 100644 --- a/test/sql/testtypes.py +++ b/test/sql/testtypes.py @@ -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 -- 2.47.3