summaryrefslogtreecommitdiff
path: root/test/ext
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-05-30 15:36:13 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-05-30 15:36:13 -0400
commit8daa6ccfb0be6486d36ebdd3cd709e8ebfbfa207 (patch)
tree6435d73175d211d02a7046a4cf8e0f0d32eb43e6 /test/ext
parent2da30fde12e312dd9ea7dfff41f50cee93fc0793 (diff)
downloadsqlalchemy-8daa6ccfb0be6486d36ebdd3cd709e8ebfbfa207.tar.gz
- The ``__mapper_args__`` dictionary is copied from a declarative
mixin or abstract class when accessed, so that modifications made to this dictionary by declarative itself won't conflict with that of other mappings. The dictionary is modified regarding the ``version_id_col`` and ``polymorphic_on`` arguments, replacing the column within with the one that is officially mapped to the local class/table. fixes #3062
Diffstat (limited to 'test/ext')
-rw-r--r--test/ext/declarative/test_mixin.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ext/declarative/test_mixin.py b/test/ext/declarative/test_mixin.py
index d8ec484e1..dab627596 100644
--- a/test/ext/declarative/test_mixin.py
+++ b/test/ext/declarative/test_mixin.py
@@ -1173,6 +1173,33 @@ class DeclarativeMixinPropertyTest(DeclarativeTestBase):
eq_(col.name, 'type_')
assert col.table is not None
+ def test_column_in_mapper_args_used_multiple_times(self):
+
+ class MyMixin(object):
+
+ version_id = Column(Integer)
+ __mapper_args__ = {'version_id_col': version_id}
+
+ class ModelOne(Base, MyMixin):
+
+ __tablename__ = 'm1'
+ id = Column(Integer, primary_key=True)
+
+ class ModelTwo(Base, MyMixin):
+
+ __tablename__ = 'm2'
+ id = Column(Integer, primary_key=True)
+
+ is_(
+ ModelOne.__mapper__.version_id_col,
+ ModelOne.__table__.c.version_id
+ )
+ is_(
+ ModelTwo.__mapper__.version_id_col,
+ ModelTwo.__table__.c.version_id
+ )
+
+
def test_deferred(self):
class MyMixin(object):