def test_transaction_failed_failure(self): def run(): EntityX(a=1).put() raise Failure() with self.assertRaises(Failure): txn.transaction(run) self.assertEqual(0, EntityX.query().count())
def test_transaction(self): def run(): EntityX(a=1).put() return 2 self.assertEqual(2, txn.transaction(run)) self.assertEqual(1, EntityX.query().count())