Commits

Michael Trier committed 3155bcc

Corrected some ordering issues with tests.

  • Participants
  • Parent commits 75a9287

Comments (0)

Files changed (3)

File test/orm/expire.py

         mapper(Address, addresses)
 
         sess = create_session()
-        userlist = sess.query(User).all()
+        userlist = sess.query(User).order_by(User.id).all()
         assert self.static.user_address_result == userlist
         assert len(list(sess)) == 9
         sess.expire_all()
         gc.collect()
         assert len(list(sess)) == 4 # since addresses were gc'ed
 
-        userlist = sess.query(User).all()
+        userlist = sess.query(User).order_by(User.id).all()
         u = userlist[1]
-        assert self.static.user_address_result == userlist
+        self.assertEquals(self.static.user_address_result, userlist)
         assert len(list(sess)) == 9
 
 class PolymorphicExpireTest(_base.MappedTest):

File test/orm/inheritance/polymorph2.py

         
         r = session.query(Person).filter(Person.name.like('%2')).join('status').filter_by(name="active")
         assert str(list(r)) == "[Manager M2, category YYYYYYYYY, status Status active, Engineer E2, field X, status Status active]"
-        r = session.query(Engineer).join('status').filter(Person.name.in_(['E2', 'E3', 'E4', 'M4', 'M2', 'M1']) & (status.c.name=="active"))
+        r = session.query(Engineer).join('status').filter(Person.name.in_(['E2', 'E3', 'E4', 'M4', 'M2', 'M1']) & (status.c.name=="active")).order_by(Person.name)
         assert str(list(r)) == "[Engineer E2, field X, status Status active, Engineer E3, field X, status Status active]"
 
         r = session.query(Person).filter(exists([1], Car.owner==Person.person_id))

File test/orm/query.py

         q = sess.query(User)
         AdAlias = aliased(Address)
         q = q.add_entity(AdAlias).select_from(outerjoin(User, AdAlias))
-        l = q.all()
+        l = q.order_by(User.id, Address.id).all()
         self.assertEquals(l, expected)
 
         sess.clear()
         adalias = addresses.alias()
         q = sess.query(User).select_from(users.outerjoin(adalias)).options(contains_eager(User.addresses, alias=adalias))
         def go():
-            assert fixtures.user_address_result == q.all()
+            self.assertEquals(fixtures.user_address_result, q.order_by(User.id).all())
         self.assert_sql_count(testing.db, go, 1)
         sess.clear()
 
         q = sess.query(User)
         adalias = addresses.alias('adalias')
         q = q.add_entity(Address, alias=adalias).select_from(users.outerjoin(adalias))
-        l = q.all()
+        l = q.order_by(User.id, Address.id).all()
         assert l == expected
 
         sess.clear()
             Address(id=4, user=User(id=8, concat=16, count=3)),
             Address(id=5, user=User(id=9, concat=18, count=1))
         ]
-
         self.assertEquals(sess.query(Address).all(), address_result)
 
         # run the eager version twice to test caching of aliased clauses
         )
 
         self.assertEquals(
-                sess.query(Address, ualias.count).join(('user', ualias)).join('user', aliased=True).all(),
+                sess.query(Address, ualias.count).join(('user', ualias)).join('user', aliased=True).order_by(Address.id).all(),
                 [
                     (Address(id=1), 1),
                     (Address(id=2), 3),
                 ]
             )
 
-        self.assertEquals(sess.query(Address, ualias.concat, ualias.count).join(('user', ualias)).join('user', aliased=True).all(),
+        self.assertEquals(sess.query(Address, ualias.concat, ualias.count).join(('user', ualias)).join('user', aliased=True).order_by(Address.id).all(),
             [
                 (Address(id=1), 14, 1),
                 (Address(id=2), 16, 3),