assert state.obj() is None
assert state.dict == {}
+ @testing.requires.predictable_gc
def test_object_dereferenced_error(self):
class Foo(object):
pass
)
def test_deferred(self):
- class Foo(object):pass
+ class Foo(object):
+ pass
data = {'a':'this is a', 'b':12}
def loader(state, keys):
assert len(u.addresses) == 3
sess.expire(u)
assert 'addresses' not in u.__dict__
- print("-------------------------------------------")
sess.query(User).filter_by(id=8).all()
assert 'addresses' in u.__dict__
assert len(u.addresses) == 3
+ @testing.requires.predictable_gc
def test_expire_all(self):
users, Address, addresses, User = (self.tables.users,
self.classes.Address,
sess = create_session()
userlist = sess.query(User).order_by(User.id).all()
- assert self.static.user_address_result == userlist
- assert len(list(sess)) == 9
+ eq_(self.static.user_address_result, userlist)
+ eq_(len(list(sess)), 9)
sess.expire_all()
gc_collect()
- assert len(list(sess)) == 4 # since addresses were gc'ed
+ eq_(len(list(sess)), 4) # since addresses were gc'ed
userlist = sess.query(User).order_by(User.id).all()
u = userlist[1]
eq_(self.static.user_address_result, userlist)
- assert len(list(sess)) == 9
+ eq_(len(list(sess)), 9)
def test_state_change_col_to_deferred(self):
"""Behavioral test to verify the current activity of loader callables."""