summaryrefslogtreecommitdiff
path: root/test/engine/test_reflection.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/engine/test_reflection.py')
-rw-r--r--test/engine/test_reflection.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py
index 13c8ee0ef..f385a0fa2 100644
--- a/test/engine/test_reflection.py
+++ b/test/engine/test_reflection.py
@@ -203,7 +203,7 @@ class ReflectionTest(fixtures.TestBase, ComparesTables):
assert len(t2.indexes) == 2
@testing.provide_metadata
- def test_autoload_replace(self):
+ def test_autoload_replace_foreign_key(self):
a = Table('a', self.metadata, Column('id', Integer, primary_key=True))
b = Table('b', self.metadata, Column('id', Integer, primary_key=True),
Column('a_id', Integer))
@@ -220,6 +220,18 @@ class ReflectionTest(fixtures.TestBase, ComparesTables):
assert b2.c.a_id.references(a2.c.id)
eq_(len(b2.constraints), 2)
+ @testing.provide_metadata
+ def test_autoload_replace_primary_key(self):
+ a = Table('a', self.metadata, Column('id', Integer))
+ self.metadata.create_all()
+
+ m2 = MetaData()
+ a2 = Table('a', m2, Column('id', Integer, primary_key=True))
+
+ Table('a', m2, autoload=True, autoload_with=testing.db,
+ autoload_replace=False, extend_existing=True)
+ eq_(list(a2.primary_key), [a2.c.id])
+
def test_autoload_replace_arg(self):
Table('t', MetaData(), autoload_replace=False)