예제 #1
0
    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")
예제 #2
0
 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)