From 39b213ccbeab97184b462952d458e110b1f21a50 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 5 Jul 2009 15:19:17 +0000 Subject: [PATCH] test tweaks --- test/orm/test_cascade.py | 2 +- test/orm/test_unitofwork.py | 2 +- test/sql/test_constraints.py | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/test/orm/test_cascade.py b/test/orm/test_cascade.py index 72c1441e9a..c523fb5f01 100644 --- a/test/orm/test_cascade.py +++ b/test/orm/test_cascade.py @@ -445,7 +445,7 @@ class M2OCascadeTest(_base.MappedTest): jack.pref = newpref jack.pref = newpref sess.flush() - eq_(sess.query(Pref).all(), + eq_(sess.query(Pref).order_by(Pref.id).all(), [Pref(data="pref 1"), Pref(data="pref 3"), Pref(data="newpref")]) class M2OCascadeDeleteTest(_base.MappedTest): diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py index 84d20ed92c..efd00c1f09 100644 --- a/test/orm/test_unitofwork.py +++ b/test/orm/test_unitofwork.py @@ -1005,7 +1005,7 @@ class DefaultTest(_base.MappedTest): """A server-side default can be used as the target of a foreign key""" mapper(Hoho, default_t, properties={ - 'secondaries':relation(Secondary)}) + 'secondaries':relation(Secondary, order_by=secondary_table.c.id)}) mapper(Secondary, secondary_table) h1 = Hoho() diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index 1ad03f357b..bdf3e7d3f5 100644 --- a/test/sql/test_constraints.py +++ b/test/sql/test_constraints.py @@ -286,6 +286,7 @@ class ConstraintCompilationTest(TestBase, AssertsCompiledSQL): t2 = Table('t2', m, Column('a', Integer, ForeignKey('t.a', use_alter=True, name='fk_ta')), + Column('b', Integer, ForeignKey('t.a', name='fk_tb')), # to ensure create ordering ... ) e = engines.mock_engine(dialect_name='postgres') @@ -293,12 +294,12 @@ class ConstraintCompilationTest(TestBase, AssertsCompiledSQL): m.drop_all(e) e.assert_sql([ - "CREATE TABLE t (a INTEGER)", - "CREATE TABLE t2 (a INTEGER)", - "ALTER TABLE t2 ADD CONSTRAINT fk_ta FOREIGN KEY(a) REFERENCES t (a)", - "ALTER TABLE t2 DROP CONSTRAINT fk_ta", - "DROP TABLE t2", - "DROP TABLE t", + 'CREATE TABLE t (a INTEGER)', + 'CREATE TABLE t2 (a INTEGER, b INTEGER, CONSTRAINT fk_tb FOREIGN KEY(b) REFERENCES t (a))', + 'ALTER TABLE t2 ADD CONSTRAINT fk_ta FOREIGN KEY(a) REFERENCES t (a)', + 'ALTER TABLE t2 DROP CONSTRAINT fk_ta', + 'DROP TABLE t2', + 'DROP TABLE t' ]) -- 2.47.3