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
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