[docs]deftest_transaction_delete(close=False):setupClass(SOTestSOTrans)connection=SOTestSOTrans._connectionif(connection.dbName=='sqlite')andconnection._memory:pytest.skip("The test doesn't work with sqlite memory connection")trans=connection.transaction()try:SOTestSOTrans(name='bob')bIn=SOTestSOTrans.byName('bob',connection=trans)bIn.destroySelf()bOut=SOTestSOTrans.select(SOTestSOTrans.q.name=='bob')assertbOut.count()==1bOutInst=bOut[0]bOutID=bOutInst.id# noqa: bOutID is used in the string code belowtrans.commit(close=close)assertbOut.count()==0raises(SQLObjectNotFound,"SOTestSOTrans.get(bOutID)")raises(SQLObjectNotFound,"bOutInst.name")finally:trans.rollback()connection.autoCommit=Trueconnection.close()