示例#1
0
 def testRegister(self):
     tm = ProxyTM(Target())
     self.assertEqual(len(tr()), 0)
     tm._register()
     self.assertEqual(len(tr()), 1)
     try:
         self.assertEqual(tr()[0].manager, tm)
     except AttributeError:
         pass  # ZODB <= 3.2
示例#2
0
 def testRegister(self):
     tm = ProxyTM(Target())
     self.assertEqual(len(tr()), 0)
     tm._register()
     self.assertEqual(len(tr()), 1)
     try:
         self.assertEqual(tr()[0].manager, tm)
     except AttributeError:
         pass # ZODB <= 3.2
示例#3
0
 def testLastRegisteredComesFirst(self):
     tm1, tm2 = ProxyTM(Target()), ProxyTM(Target())
     tm1._register()
     tm2._register()
     self.assertEqual(len(tr()), 2)
     # Now make sure that tm2 comes first in the
     # transaction's _resources list
     try:
         self.assertEqual(tr()[0].manager, tm2)
         self.assertEqual(tr()[1].manager, tm1)
     except AttributeError:
         pass  # ZODB <= 3.2
示例#4
0
 def testLastRegisteredComesFirst(self):
     tm1, tm2 = ProxyTM(Target()), ProxyTM(Target())
     tm1._register()
     tm2._register()
     self.assertEqual(len(tr()), 2)
     # Now make sure that tm2 comes first in the
     # transaction's _resources list
     try:
         self.assertEqual(tr()[0].manager, tm2)
         self.assertEqual(tr()[1].manager, tm1)
     except AttributeError:
         pass # ZODB <= 3.2