|G_Tc@sddlmZddlZddlZeadejfdYZdej fdYZ dZ dZ e d kre ndS( i(twith_statementNt MyConnectioncBseZdZRS(cCstatjj|dS(N(tTruet did_rollbacktsqlitet Connectiontrollback(tself((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pyRs(t__name__t __module__R(((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pyRst ContextTestscBs5eZdZdZdZdZdZRS(cCs2tjddt|_|jjdtadS(Ns:memory:tfactoryscreate table test(c unique)(RtconnectRtcontexecutetFalseR(R((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pytsetUp%scCs|jjdS(N(R tclose(R((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pyttearDown+scCs|jWdQXdS(s7Can the connection be used as a context manager at all?N(R (R((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pytCheckContextManager.s cCs]|j|jjdWdQX|jj|jjdjd}|j|ddS(s*Is a commit called in the context manager?s"insert into test(c) values ('foo')Nsselect count(*) from testii(R RRtfetchonet assertEqual(Rtcount((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pytCheckContextManagerCommit3s   cCso|jtty4|j%|jjd|jjdWdQXWntjk rZnX|jttdS(s,Is a rollback called in the context manager?sinsert into test(c) values (4)N(RRRR RRtIntegrityErrorR(R((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pytCheckContextManagerRollback;s (RR RRRRR(((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pyR $s     cCs"tjtd}tj|fS(NtCheck(tunittestt makeSuiteR t TestSuite(t ctx_suite((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pytsuiteGscCs tj}|jtdS(N(RtTextTestRunnertrunR(trunner((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pyttestKs t__main__(t __future__RRtsqlite3RRRRRtTestCaseR RR#R(((s2/usr/local/lib/python2.7/sqlite3/test/py25tests.pyts  #