summaryrefslogtreecommitdiff
path: root/test/ext/test_declarative.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-06-14 10:08:34 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-06-14 10:08:34 -0400
commit23a14f29da6607ee78f95c4bff9af7768c6e7954 (patch)
tree03c4a0ab2d87a38db4a63bab4273d7738bf175af /test/ext/test_declarative.py
parenteaa7aa4239af4f42cdb8b370120d1538c6704d6b (diff)
downloadsqlalchemy-23a14f29da6607ee78f95c4bff9af7768c6e7954.tar.gz
- Fixed declarative bug where a class inheriting
from a superclass of the same name would fail due to an unnecessary lookup of the name in the _decl_class_registry. [ticket:2194]
Diffstat (limited to 'test/ext/test_declarative.py')
-rw-r--r--test/ext/test_declarative.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/ext/test_declarative.py b/test/ext/test_declarative.py
index 709560dd0..1adaf6e5f 100644
--- a/test/ext/test_declarative.py
+++ b/test/ext/test_declarative.py
@@ -1272,7 +1272,7 @@ class DeclarativeInheritanceTest(DeclarativeTestBase):
assert 'inherits' not in Person.__mapper_args__
assert class_mapper(Engineer).polymorphic_identity is None
assert class_mapper(Engineer).polymorphic_on is Person.__table__.c.type
-
+
def test_we_must_only_copy_column_mapper_args(self):
class Person(Base):
@@ -1292,8 +1292,8 @@ class DeclarativeInheritanceTest(DeclarativeTestBase):
}
assert class_mapper(Person).version_id_col == 'a'
assert class_mapper(Person).include_properties == set(['id', 'a', 'b'])
-
-
+
+
def test_custom_join_condition(self):
class Foo(Base):
@@ -2001,6 +2001,19 @@ class DeclarativeInheritanceTest(DeclarativeTestBase):
assert_raises_message(sa.exc.ArgumentError,
'place __table_args__', go)
+ @testing.emits_warning("The classname")
+ def test_dupe_name_in_hierarchy(self):
+ class A(Base):
+ __tablename__ = "a"
+ id = Column( Integer, primary_key=True)
+ a_1 = A
+ class A(a_1):
+ __tablename__ = 'b'
+
+ id = Column(Integer(),ForeignKey(a_1.id), primary_key = True)
+
+ assert A.__mapper__.inherits is a_1.__mapper__
+
def test_concrete(self):
engineers = Table('engineers', Base.metadata, Column('id',
Integer, primary_key=True,