diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-13 20:38:30 -0700 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-13 20:38:30 -0700 |
| commit | bf57355feeb6f04d33ad778709f2fb39ad699aee (patch) | |
| tree | 69e1c51d7a912fa5286e6efae33a6ff498aea73f /test/sql | |
| parent | 4d2c1e2f17c702fd40af91532a36ec1b12db08fd (diff) | |
| download | sqlalchemy-bf57355feeb6f04d33ad778709f2fb39ad699aee.tar.gz | |
- [bug] Fixed bug in C extensions whereby
string format would not be applied to a
Numeric value returned as integer; this
affected primarily SQLite which does
not maintain numeric scale settings.
[ticket:2432]
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_types.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 793d5cb12..f261c4ec8 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -1547,7 +1547,7 @@ class NumericTest(fixtures.TestBase): metadata.drop_all() @testing.emits_warning(r".*does \*not\* support Decimal objects natively") - def _do_test(self, type_, input_, output, filter_ = None): + def _do_test(self, type_, input_, output, filter_=None, check_scale=False): t = Table('t', metadata, Column('x', type_)) t.create() t.insert().execute([{'x':x} for x in input_]) @@ -1560,6 +1560,11 @@ class NumericTest(fixtures.TestBase): #print result #print output eq_(result, output) + if check_scale: + eq_( + [str(x) for x in result], + [str(x) for x in output], + ) def test_numeric_as_decimal(self): self._do_test( @@ -1676,6 +1681,17 @@ class NumericTest(fixtures.TestBase): numbers ) + def test_numeric_no_decimal(self): + numbers = set([ + decimal.Decimal("1.000") + ]) + self._do_test( + Numeric(precision=5, scale=3), + numbers, + numbers, + check_scale=True + ) + class NumericRawSQLTest(fixtures.TestBase): """Test what DBAPIs and dialects return without any typing information supplied at the SQLA level. |
