Exemple #1
0
 def check_touch_every_reference(self):
     connection = Connection(self._get_storage())
     root = connection.get_root()
     root['a'] = Persistent()
     root['b'] = Persistent()
     from durus.persistent_list import PersistentList
     root['b'].c = PersistentList()
     connection.commit()
     touch_every_reference(connection, 'PersistentList')
     assert root['b']._p_is_unsaved()
     assert root['b'].c._p_is_unsaved()
     assert not root._p_is_unsaved()
     assert len(list(connection.get_cache())) == 4
Exemple #2
0
 def check_touch_every_reference(self):
     connection = Connection(self._get_storage())
     root = connection.get_root()
     root['a'] = Persistent()
     root['b'] = Persistent()
     from durus.persistent_list import PersistentList
     root['b'].c = PersistentList()
     connection.commit()
     touch_every_reference(connection, 'PersistentList')
     assert root['b']._p_is_unsaved()
     assert root['b'].c._p_is_unsaved()
     assert not root._p_is_unsaved()
     assert len(list(connection.get_cache())) == 4
Exemple #3
0
 def check_shrink(self):
     storage = self._get_storage()
     self.conn=conn=Connection(storage, cache_size=3)
     self.root=root=conn.get_root()
     root['a'] = Persistent()
     root['b'] = Persistent()
     root['c'] = Persistent()
     assert self.root._p_is_unsaved()
     conn.commit()
     root['a'].a = 1
     conn.commit()
     root['b'].b = 1
     root['c'].c = 1
     root['d'] = Persistent()
     root['e'] = Persistent()
     root['f'] = Persistent()
     conn.commit()
     root['f'].f = 1
     root['g'] = Persistent()
     conn.commit()
     conn.pack()
Exemple #4
0
 def check_shrink(self):
     storage = self._get_storage()
     self.conn = conn = Connection(storage, cache_size=3)
     self.root = root = conn.get_root()
     root['a'] = Persistent()
     root['b'] = Persistent()
     root['c'] = Persistent()
     assert self.root._p_is_unsaved()
     conn.commit()
     root['a'].a = 1
     conn.commit()
     root['b'].b = 1
     root['c'].c = 1
     root['d'] = Persistent()
     root['e'] = Persistent()
     root['f'] = Persistent()
     conn.commit()
     root['f'].f = 1
     root['g'] = Persistent()
     conn.commit()
     conn.pack()