Mike Bayer avatar Mike Bayer committed 66f0a37

fix the test

Comments (0)

Files changed (1)

test/orm/test_expire.py

         assert o1.description
 
     def test_deferred_notfound(self):
-        Order, orders = self.classes.Order, self.tables.orders
+        users, User = self.tables.users, self.classes.User
 
-        mapper(Order, orders, properties={
-                'description':deferred(orders.c.description)})
-        s = create_session()
-        o1 = s.query(Order).first()
-        assert 'description' not in o1.__dict__
-        s.expire(o1)
-        s.query(Order).delete()
+        mapper(User, users, properties={
+            'name':deferred(users.c.name)
+        })
+        s = create_session(autocommit=False)
+        u = s.query(User).get(10)
+
+        assert 'name' not in u.__dict__
+        s.execute(users.delete().where(User.id==10))
         assert_raises_message(
             sa.orm.exc.ObjectDeletedError,
-            "Instance '<Order at .*?>' has been "
+            "Instance '<User at .*?>' has been "
             "deleted, or its row is otherwise not present.",
-            getattr, o1, 'description'
+            getattr, u, 'name'
         )
 
     def test_lazyload_autoflushes(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.