summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-01-25 18:16:12 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-01-25 18:16:12 +0000
commit33a6724e33140861fbd66de61875797408a1e02e (patch)
tree78d22dae3d3b989a58fb8268f0c45088114eca54 /test
parentfadc61e8ca03358fcbb72a9e9446ab7018e295ea (diff)
downloadsqlalchemy-33a6724e33140861fbd66de61875797408a1e02e.tar.gz
- added standalone "query" class attribute generated
by a scoped_session. This provides MyClass.query without using Session.mapper. Use via: MyClass.query = Session.query_property()
Diffstat (limited to 'test')
-rw-r--r--test/orm/session.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/orm/session.py b/test/orm/session.py
index 930efe07a..0a38198ac 100644
--- a/test/orm/session.py
+++ b/test/orm/session.py
@@ -946,8 +946,10 @@ class ScopedSessionTest(ORMTest):
def test_basic(self):
Session = scoped_session(sessionmaker())
- class SomeObject(fixtures.Base):pass
- class SomeOtherObject(fixtures.Base):pass
+ class SomeObject(fixtures.Base):
+ query = Session.query_property()
+ class SomeOtherObject(fixtures.Base):
+ query = Session.query_property()
mapper(SomeObject, table, properties={
'options':relation(SomeOtherObject)
@@ -961,8 +963,9 @@ class ScopedSessionTest(ORMTest):
Session.commit()
Session.remove()
- assert SomeObject(id=1, data="hello", options=[SomeOtherObject(someid=1)]) == Session.query(SomeObject).one()
-
+ self.assertEquals(SomeObject(id=1, data="hello", options=[SomeOtherObject(someid=1)]), Session.query(SomeObject).one())
+ self.assertEquals(SomeObject(id=1, data="hello", options=[SomeOtherObject(someid=1)]), SomeObject.query.one())
+ self.assertEquals(SomeOtherObject(someid=1), SomeOtherObject.query.filter(SomeOtherObject.someid==sso.someid).one())
class ScopedMapperTest(PersistTest):
def setUpAll(self):