diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-15 11:53:37 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-15 11:53:37 -0500 |
commit | 75b5236e69b4607d549d466bd34d409f3cc9ed45 (patch) | |
tree | 5a6a325f03cd1d2180583324a2982e9ff6f343b3 /test/dialect/test_postgresql.py | |
parent | 56e59be4e7476d7d5a10760c84b8d5ee471a6d94 (diff) | |
download | sqlalchemy-75b5236e69b4607d549d466bd34d409f3cc9ed45.tar.gz |
- the _pk_processors/_prefetch_processors approach relied upon calling RPs without a cursor.description
result, also generates procs that are not used in most cases. simplify the approach
by passing type to _exec_default() to be used if needed by _execute_scalar(),
looking for the proc on just t._autoincrement_column in post_insert().
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index a8c63c566..fb5a63c9b 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -476,7 +476,7 @@ class EnumTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): metadata.drop_all() class NumericInterpretationTest(TestBase): - + __only_on__ = 'postgresql' def test_numeric_codes(self): from sqlalchemy.dialects.postgresql import pg8000, psycopg2, base @@ -493,6 +493,28 @@ class NumericInterpretationTest(TestBase): val = proc(val) assert val in (23.7, decimal.Decimal("23.7")) + @testing.provide_metadata + def test_numeric_default(self): + t =Table('t', metadata, + Column('id', Integer, primary_key=True), + Column('nd', Numeric(asdecimal=True), default=0), + Column('nf', Numeric(asdecimal=False), default=0), + Column('fd', Float(asdecimal=True), default=0), + Column('ff', Float(asdecimal=False), default=0), + ) + metadata.create_all() + r = t.insert().execute() + + row = t.select().execute().first() + assert isinstance(row[1], decimal.Decimal) + assert isinstance(row[2], float) + assert isinstance(row[3], decimal.Decimal) + assert isinstance(row[4], float) + eq_( + row, + (1, decimal.Decimal("0"), 0, decimal.Decimal("0"), 0) + ) + class InsertTest(TestBase, AssertsExecutionResults): __only_on__ = 'postgresql' |