def testFailedNestedTransaction(self): pd = persistentDict.PersistentDict(DummyFailWriter()) try: with pd.transaction(): with pd.transaction(): raise SpecialError("Take the Kama Sutra. How many people " "died from the Kama Sutra, as opposed " "to the Bible? Who wins?") # (C) Frank Zappa except RuntimeError: return self.fail("Exception was not thrown")
def testFailedWrite(self): data = "Scotty had a will of her own, which was always " + \ "dangerous in a woman." # (C) Philip K. Dick - The Three Stigmata of Palmer Eldritch pd = persistentDict.PersistentDict(DummyFailWriter()) self.assertRaises(RuntimeError, pd.__setitem__, "4", data)