Ejemplo n.º 1
0
 def __init__(self, repository, query_class=None, clone_on_load=True):
     self.__repository = repository
     self.__unit_of_work = UnitOfWork()
     self.__cache_map = {}
     if query_class is None:
         query_class = MemoryRepositoryQuery
     self.__query_class = query_class
     self.__clone_on_load = clone_on_load
     self.__needs_flushing = False
     self.__is_flushing = False
Ejemplo n.º 2
0
 def test_registered_with_other_uow_fails(self):
     ent = _MyEntity()
     uow = UnitOfWork()
     uow.register_new(_MyEntity, ent)
     with self.assert_raises(ValueError) as cm1:
         self._uow.register_new(_MyEntity, ent)
     msg1 = 'Trying to register an entity that has been'
     self.assert_true(str(cm1.exception).startswith(msg1))
     with self.assert_raises(ValueError) as cm2:
         self._uow.unregister(_MyEntity, ent)
     msg2 = 'Trying to unregister an entity that has been'
     self.assert_true(str(cm2.exception).startswith(msg2))
Ejemplo n.º 3
0
 def set_up(self):
     self._uow = UnitOfWork()