]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
test tweaks
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 5 Jul 2009 15:19:17 +0000 (15:19 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 5 Jul 2009 15:19:17 +0000 (15:19 +0000)
test/orm/test_cascade.py
test/orm/test_unitofwork.py
test/sql/test_constraints.py

index 72c1441e9ae5c832d2a5ba658eda6e47157d0904..c523fb5f0134e71d657d972ce65d9c6d76324be0 100644 (file)
@@ -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):
index 84d20ed92c5a6a98a05145b82e6b54550a80ae16..efd00c1f0919f59c2c147c58bf6710714d5152b6 100644 (file)
@@ -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()
index 1ad03f357bd6bbc2b927e3b7325b9151fd6d8df1..bdf3e7d3f5577da7ed8c84009fa10943c08fe9c1 100644 (file)
@@ -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'
         ])