summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-06-30 18:48:01 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-06-30 18:48:01 -0400
commit9ae8de1f65c89f33f4ffae33023e481955f72244 (patch)
tree23ad61fc58654c78c409a6cc332db5080315ca0d /test/sql
parent287e9d6a77ef20da98c28901fd118f4401aaab41 (diff)
downloadsqlalchemy-9ae8de1f65c89f33f4ffae33023e481955f72244.tar.gz
- Fixed bug where "autoincrement" detection on
Table would fail if the type had no "affinity" value, in particular this would occur when using the UUID example on the site that uses TypeEngine as the "impl".
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_defaults.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py
index 2bb961d4e..334a9d97c 100644
--- a/test/sql/test_defaults.py
+++ b/test/sql/test_defaults.py
@@ -6,7 +6,7 @@ import sqlalchemy as sa
from test.lib import testing, engines
from sqlalchemy import MetaData, Integer, String, ForeignKey, Boolean, exc,\
Sequence, func, literal, Unicode
-from sqlalchemy.types import TypeDecorator
+from sqlalchemy.types import TypeDecorator, TypeEngine
from test.lib.schema import Table, Column
from test.lib.testing import eq_
from sqlalchemy.dialects import sqlite
@@ -542,6 +542,16 @@ class AutoIncrementTest(fixtures.TablesTest):
id_ = r.inserted_primary_key[0]
nodes.insert().execute(data='bar', parent_id=id_)
+ def test_autoinc_detection_no_affinity(self):
+ class MyType(TypeDecorator):
+ impl = TypeEngine
+
+ assert MyType()._type_affinity is None
+ t = Table('x', MetaData(),
+ Column('id', MyType(), primary_key=True)
+ )
+ assert t._autoincrement_column is None
+
@testing.fails_on('sqlite', 'FIXME: unknown')
def test_non_autoincrement(self):
# sqlite INT primary keys can be non-unique! (only for ints)