Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/sqlite3/test/dbapi.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@sTddlZddlZddlZyddlZWnek
rMeZnXdejfd��YZdejfd��YZ	dejfd��YZ
ejed�d	ejfd
��Y�Zdejfd��YZ
d
ejfd��YZdejfd��YZdejfd��YZd�Zd�ZedkrPe�ndS(i�NtModuleTestscBs}eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(
cCs!|jtjddtj�dS(Ns2.0sapilevel is %s, should be 2.0(tassertEqualtsqlitetapilevel(tself((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckAPILevel!scCs!|jtjddtj�dS(Nisthreadsafety is %d, should be 1(RRtthreadsafety(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckThreadSafety%scCs!|jtjddtj�dS(Ntqmarks%paramstyle is '%s', should be 'qmark'(RRt
paramstyle(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckParamStyle)scCs |jttjt�d�dS(Ns*Warning is not a subclass of StandardError(t
assertTruet
issubclassRtWarningt
StandardError(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckWarning.scCs |jttjt�d�dS(Ns(Error is not a subclass of StandardError(RRRtErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckError2scCs#|jttjtj�d�dS(Ns)InterfaceError is not a subclass of Error(RRRtInterfaceErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckInterfaceError6scCs#|jttjtj�d�dS(Ns(DatabaseError is not a subclass of Error(RRRt
DatabaseErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckDatabaseError:scCs#|jttjtj�d�dS(Ns,DataError is not a subclass of DatabaseError(RRRt	DataErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckDataError>scCs#|jttjtj�d�dS(Ns3OperationalError is not a subclass of DatabaseError(RRRtOperationalErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckOperationalErrorBscCs#|jttjtj�d�dS(Ns1IntegrityError is not a subclass of DatabaseError(RRRtIntegrityErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckIntegrityErrorFscCs#|jttjtj�d�dS(Ns0InternalError is not a subclass of DatabaseError(RRRt
InternalErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckInternalErrorJscCs#|jttjtj�d�dS(Ns3ProgrammingError is not a subclass of DatabaseError(RRRtProgrammingErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckProgrammingErrorNscCs#|jttjtj�d�dS(Ns4NotSupportedError is not a subclass of DatabaseError(RRRtNotSupportedErrorR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckNotSupportedErrorRs	(t__name__t
__module__RRR
RRRRRRRRRR!(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR s												tConnectionTestscBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCsBtjd�|_|jj�}|jd�|jdd�dS(Ns:memory:s4create table test(id integer primary key, name text)s!insert into test(name) values (?)tfoo(sfoo(Rtconnecttcxtcursortexecute(Rtcu((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytsetUpXs
cCs|jj�dS(N(R'tclose(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyttearDown^scCs|jj�dS(N(R'tcommit(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCommitascCs|jj�|jj�dS(sV
        A commit should also work when no changes were made to the database.
        N(R'R.(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCommitAfterNoChangesds
cCs|jj�dS(N(R'trollback(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckRollbackkscCs|jj�|jj�dS(sX
        A rollback should also work when no changes were made to the database.
        N(R'R1(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckRollbackAfterNoChangesns
cCs|jj�}dS(N(R'R((RR*((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCursoruscCsBd}ytj|�}Wntjk
r0dSX|jd�dS(Ns/foo/bar/bla/23534/mydb.dbs&should have raised an OperationalError(RR&Rtfail(RtYOU_CANNOT_OPEN_THIStcon((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckFailedOpenxscCs|jj�dS(N(R'R,(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckClose�scCs�|j|jjtj�|j|jjtj�|j|jjtj�|j|jjtj�|j|jjtj�|j|jjtj�|j|jj	tj	�|j|jj
tj
�|j|jjtj�|j|jjtj�dS(N(
RR'R
RRRRRRRRRR (R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExceptions�s(R"R#R+R-R/R0R2R3R4R8R9R:(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR$Ws									tCursorTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/RS(.cCsKtjd�|_|jj�|_|jjd�|jjdd�dS(Ns:memory:sCcreate table test(id integer primary key, name text, income number)s!insert into test(name) values (?)R%(sfoo(RR&R'R(R*R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR+�scCs|jj�|jj�dS(N(R*R,R'(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR-�s
cCs|jjd�dS(Nsdelete from test(R*R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteNoArgs�scCsPy!|jjd�|jd�Wn(tjk
r8dS|jd�nXdS(Nsselect asdfs&should have raised an OperationalErrorsraised wrong exception(R*R)R5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteIllegalSql�scCsPy!|jjd�|jd�Wn(tjk
r8dS|jd�nXdS(Nsselect 5+4; select 4+5sshould have raised a Warningsraised wrong exception(R*R)R5RR
(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteTooMuchSql�scCs|jjd�dS(Nsselect 5+4; -- foo bar(R*R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteTooMuchSql2�scCs|jjd�dS(NsT
            select 5+4;

            /*
            foo
            */
            (R*R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteTooMuchSql3�s	cCsMy!|jjd�|jd�Wn%tk
r5dS|jd�nXdS(Ni*sshould have raised a ValueErrorsraised wrong exception.(R*R)R5t
ValueError(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteWrongSqlArg�s
cCs|jjdd�dS(Nsinsert into test(id) values (?)i*(i*(R*R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteArgInt�scCs|jjdd�dS(Ns#insert into test(income) values (?)gp=
ף�@(gp=
ף�@(R*R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteArgFloat�scCs|jjdd�dS(Ns!insert into test(name) values (?)tHugo(RE(R*R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteArgString�scCsV|jjdd�|jjd|jjf�|jj�}|j|dd�dS(Ns!insert into test(name) values (?)tHugos select name from test where id=?i(RG(R*R)t	lastrowidtfetchoneR(Rtrow((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt!CheckExecuteArgStringWithZeroByte�scCs?y$|jjdd�|jd�Wntjk
r:nXdS(Nsinsert into test(id) values (?)itEgons#should have raised ProgrammingError(iRL(R*R)R5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteWrongNoOfArgs1�s
cCs<y!|jjd�|jd�Wntjk
r7nXdS(Nsinsert into test(id) values (?)s#should have raised ProgrammingError(R*R)R5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteWrongNoOfArgs2�s
cCs<y!|jjd�|jd�Wntjk
r7nXdS(Nsinsert into test(id) values (?)s#should have raised ProgrammingError(R*R)R5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteWrongNoOfArgs3�s
cCsM|jjd�|jjddg�|jj�}|j|dd�dS(Ns%insert into test(name) values ('foo')s"select name from test where name=?R%i(R*R)RIR(RRJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteParamList�scCscdtfd��Y}|jjd�|jjd|��|jj�}|j|dd�dS(NtLcBseZd�Zd�ZRS(cSsdS(Ni((R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt__len__�scSs|dkst�dS(NiR%(tAssertionError(Rtx((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt__getitem__�s(R"R#RRRU(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyRQ�s	s%insert into test(name) values ('foo')s"select name from test where name=?iR%(tobjectR*R)RIR(RRQRJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteParamSequence�s
cCsQ|jjd�|jjdidd6�|jj�}|j|dd�dS(Ns%insert into test(name) values ('foo')s&select name from test where name=:nameR%tnamei(R*R)RIR(RRJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteDictMappingscCsvtjd	krdSdtfd��Y}|jjd�|jjd|��|jj�}|j|dd�dS(
NiiitDcBseZd�ZRS(cSsdS(NR%((Rtkey((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt__missing__s(R"R#R\(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyRZss%insert into test(name) values ('foo')s&select name from test where name=:nameR%(iii(tsystversion_infotdictR*R)RIR(RRZRJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteDictMapping_MappingscCsV|jjd�y+|jjdidd6�|jd�Wntjk
rQnXdS(Ns%insert into test(name) values ('foo')s1select name from test where name=:name and id=:idR%RXs#should have raised ProgrammingError(R*R)R5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt$CheckExecuteDictMappingTooLittleArgsscCsL|jjd�y!|jjd�|jd�Wntjk
rGnXdS(Ns%insert into test(name) values ('foo')s&select name from test where name=:names#should have raised ProgrammingError(R*R)R5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteDictMappingNoArgsscCsV|jjd�y+|jjdidd6�|jd�Wntjk
rQnXdS(Ns%insert into test(name) values ('foo')s"select name from test where name=?R%RXs#should have raised ProgrammingError(R*R)R5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteDictMappingUnnamed$scCs|jj�dS(N(R*R,(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR9,scCsZ|jjd�|jjd�|jjd�|jjd�|j|jjd�dS(Nsdelete from tests%insert into test(name) values ('foo')supdate test set name='bar'i(R*R)Rtrowcount(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckRowcountExecute/s
cCs*|jjd�|j|jjd�dS(s�
        pysqlite does not know the rowcount of SELECT statements, because we
        don't fetch all rows after executing the select statement. The rowcount
        has thus to be -1.
        sselect 5 union select 6i�N(R*R)RRd(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckRowcountSelect6scCsF|jjd�|jjddddg�|j|jjd�dS(	Nsdelete from tests!insert into test(name) values (?)iii(i(i(i(R*R)texecutemanyRRd(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckRowcountExecutemany?scCsF|jjd�|jjd�|jjdkrB|jd�ndS(Ns%insert into test(name) values ('foo')is"total changes reported wrong value(R*R)R't
total_changesR5(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckTotalChangesDscCs6|jjdgtdd�D]}|f^q�dS(Ns#insert into test(income) values (?)idin(R*Rgtrange(RRT((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteManySequenceNscCs-ddd��Y}|jjd|��dS(NtMyItercBseZd�Zd�ZRS(cSs
d|_dS(Ni(tvalue(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt__init__SscSs5|jdkrt�n|jd7_|jfSdS(Ni
i(Rnt
StopIteration(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytnextVs	(R"R#RoRq(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyRmRs	s#insert into test(income) values (?)((R*Rg(RRm((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteManyIteratorQscCs#d�}|jjd|��dS(Ncss#xtd�D]}|fVq
WdS(Ni(Rk(ti((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytmygen`ss#insert into test(income) values (?)(R*Rg(RRt((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteManyGenerator_s	cCsSy'|jjddg�|jd�Wn%tk
r;dS|jd�nXdS(Ni*isshould have raised a ValueErrorsraised wrong exception.(i(R*RgR5RA(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteManyWrongSqlArgfs
cCsVy'|jjddg�|jd�Wn(tjk
r>dS|jd�nXdS(Nsselect ?is%should have raised a ProgrammingErrorsraised wrong exception.(i(R*RgR5RR(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteManySelectoscCshy$|jjdd�|jd�Wn=tk
r8dStk
rc}dG|jGH|jd�nXdS(Ns#insert into test(income) values (?)i*sshould have raised a TypeErrortraisedsraised wrong exception.(R*RgR5t	TypeErrort	Exceptiont	__class__(Rte((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckExecuteManyNotIterablexs
cCs�|jjd�|jjdd�|jjdd	�|jjd�g}x"|jD]}|j|d�qVW|j|dd�|j|dd�dS(
Nsdelete from testsinsert into test(id) values (?)iisselect id from test order by idii(i(i(R*R)tappendR(RtlstRJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckFetchIter�scCsV|jjd�|jj�}|j|dd�|jj�}|j|d�dS(Nsselect name from testiR%(R*R)RIRtNone(RRJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckFetchone�s
cCs/|jj�}|j�}|j|d�dS(N(R'R(RIRR�(RtcurRJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckFetchoneNoStatement�scCs�|j|jjd�d|j_|jjd�|jjd�|jjd�|jjd�|jjd�|jj�}|jt|�d�dS(Niisdelete from tests#insert into test(name) values ('A')s#insert into test(name) values ('B')s#insert into test(name) values ('C')sselect name from test(RR*t	arraysizeR)t	fetchmanytlen(Rtres((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckArraySize�scCs^|jjd�|jjd�}|jt|�d�|jjd�}|j|g�dS(Nsselect name from testidi(R*R)R�RR�(RR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckFetchmany�s
cCs?|jjd�|jjdd�}|jt|�d�dS(s0Checks if fetchmany works with keyword argumentssselect name from testtsizeidiN(R*R)R�RR�(RR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckFetchmanyKwArg�scCsX|jjd�|jj�}|jt|�d�|jj�}|j|g�dS(Nsselect name from testi(R*R)tfetchallRR�(RR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckFetchall�s
cCs|jjdddg�dS(Niii(R*t
setinputsizes(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckSetinputsizes�scCs|jjdd�dS(Nii(R*t
setoutputsize(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckSetoutputsize�scCs|jjd�dS(Ni*(R*R�(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckSetoutputsizeNoColumn�scCs|j|jj|j�dS(N(RR*t
connectionR'(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCursorConnection�scCsRy,d�}|jj|�}|jd�Wntk
r@dSX|jd�dS(NcSsdS(N((((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytf�ssshould have raised a TypeErrorsshould have raised a ValueError(R'R(R5Ry(RR�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckWrongCursorCallable�s	
cCsTddd��Y}|�}y tj|�}|jd�Wntk
rOnXdS(NtFoocBseZRS((R"R#(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR��ssshould have raised a ValueError((RtCursorR5Ry(RR�R%R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCursorWrongClass�s	
(0R"R#R+R-R<R=R>R?R@RBRCRDRFRKRMRNRORPRWRYR`RaRbRcR9ReRfRhRjRlRrRuRvRwR}R�R�R�R�R�R�R�R�R�R�R�R�R�(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR;�s\																					
											
								
													sThis test requires threading.tThreadTestscBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCs8tjd�|_|jj�|_|jjd�dS(Ns:memory:s\create table test(id integer primary key, name text, bin binary, ratio number, ts timestamp)(RR&R7R(R�R)(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR+�scCs|jj�|jj�dS(N(R�R,R7(R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR-�s
cCs{d�}g}tjd|di|jd6|d6�}|j�|j�t|�dkrw|jdj|��ndS(NcSsPy!|j�}|jd�dSWn(tjk
r8dS|jd�nXdS(Nsdid not raise ProgrammingErrorsraised wrong exception(R(R~RR(R7terrorsR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytrun�s
ttargettkwargsR7R�is
(t	threadingtThreadR7tstarttjoinR�R5(RR�R�tt((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckConCursor�s	
)

cCs{d�}g}tjd|di|jd6|d6�}|j�|j�t|�dkrw|jdj|��ndS(NcSsNy|j�|jd�dSWn(tjk
r6dS|jd�nXdS(Nsdid not raise ProgrammingErrorsraised wrong exception(R.R~RR(R7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR��s

R�R�R7R�is
(R�R�R7R�R�R�R5(RR�R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckConCommit�s	
)

cCs{d�}g}tjd|di|jd6|d6�}|j�|j�t|�dkrw|jdj|��ndS(NcSsNy|j�|jd�dSWn(tjk
r6dS|jd�nXdS(Nsdid not raise ProgrammingErrorsraised wrong exception(R1R~RR(R7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�s

R�R�R7R�is
(R�R�R7R�R�R�R5(RR�R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckConRollback
s	
)

cCs{d�}g}tjd|di|jd6|d6�}|j�|j�t|�dkrw|jdj|��ndS(NcSsNy|j�|jd�dSWn(tjk
r6dS|jd�nXdS(Nsdid not raise ProgrammingErrorsraised wrong exception(R,R~RR(R7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR� s

R�R�R7R�is
(R�R�R7R�R�R�R5(RR�R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckConCloses	
)

cCs{d�}g}tjd|di|jd6|d6�}|j�|j�t|�dkrw|jdj|��ndS(NcSsQy"|jd�|jd�dSWn(tjk
r9dS|jd�nXdS(Ns#insert into test(name) values ('a')sdid not raise ProgrammingErrorsraised wrong exception(R)R~RR(R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�2s

R�R�R�R�is
(R�R�R�R�R�R�R5(RR�R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCurImplicitBegin1s	
)

cCs{d�}g}tjd|di|jd6|d6�}|j�|j�t|�dkrw|jdj|��ndS(NcSsNy|j�|jd�dSWn(tjk
r6dS|jd�nXdS(Nsdid not raise ProgrammingErrorsraised wrong exception(R,R~RR(R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�Ds

R�R�R�R�is
(R�R�R�R�R�R�R5(RR�R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
CheckCurCloseCs	
)

cCs�d�}g}|jjd�tjd|di|jd6|d6�}|j�|j�t|�dkr�|jdj|��ndS(	NcSsQy"|jd�|jd�dSWn(tjk
r9dS|jd�nXdS(Nsselect name from testsdid not raise ProgrammingErrorsraised wrong exception(R)R~RR(R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�Vs

s#insert into test(name) values ('a')R�R�R�R�is
(R�R)R�R�R�R�R�R5(RR�R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCurExecuteUs	
)

cCs�d�}g}|jjd�|jjd�tjd|di|jd6|d6�}|j�|j�t|�dkr�|jd	j|��ndS(
NcSsPy!|j�}|jd�dSWn(tjk
r8dS|jd�nXdS(Nsdid not raise ProgrammingErrorsraised wrong exception(RIR~RR(R�R�RJ((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�is
s#insert into test(name) values ('a')sselect name from testR�R�R�R�is
(R�R)R�R�R�R�R�R5(RR�R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckCurIterNexths	
)

(R"R#R+R-R�R�R�R�R�R�R�R�(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR��s									tConstructorTestscBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCstjddd�}dS(Ni�i
i(RtDate(Rtd((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt	CheckDate}scCstjddd�}dS(Nii'i#(RtTime(RR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt	CheckTime�scCs"tjdddddd�}dS(Ni�i
iii'i#(Rt	Timestamp(Rtts((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckTimestamp�scCstjd�}dS(Ni*(Rt
DateFromTicks(RR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckDateFromTicks�scCstjd�}dS(Ni*(Rt
TimeFromTicks(RR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckTimeFromTicks�scCstjd�}dS(Ni*(RtTimestampFromTicks(RR�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckTimestampFromTicks�scCstjtd�d�}dS(Nit'(RtBinarytchr(Rtb((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckBinary�s(	R"R#R�R�R�R�R�R�R�(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�|s						tExtensionTestscBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsYtjd�}|j�}|jd�|jd�|j�d}|j|d�dS(Ns:memory:s�
            -- bla bla
            /* a stupid comment */
            create table a(i);
            insert into a(i) values (5);
            sselect i from aii(RR&R(t
executescriptR)RIR(RR7R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckScriptStringSql�s
cCsYtjd�}|j�}|jd�|jd�|j�d}|j|d�dS(Ns:memory:u�
            create table a(i);
            insert into a(i) values (5);
            select i from a;
            delete from a;
            insert into a(i) values (6);
            sselect i from aii(RR&R(R�R)RIR(RR7R�R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckScriptStringUnicode�s
cCsftjd�}|j�}t}y|jd�Wntjk
rNt}nX|j|td�dS(Ns:memory:s1create table test(x); asdf; create table test2(x)sshould have raised an exception(RR&R(tFalseR�RtTrueR(RR7R�Rx((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckScriptSyntaxError�s
cCsftjd�}|j�}t}y|jd�Wntjk
rNt}nX|j|td�dS(Ns:memory:s5create table test(sadfsadfdsa); select foo from hurz;sshould have raised an exception(RR&R(R�R�RR�R(RR7R�Rx((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckScriptErrorNormal�s
cCs?tjd�}|jd�j�d}|j|dd�dS(Ns:memory:sselect 5iis Basic test of Connection.execute(RR&R)RIR(RR7tresult((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckConnectionExecute�scCs�tjd�}|jd�|jdd
dg�|jd�j�}|j|dddd�|j|d	ddd�dS(Ns:memory:screate table test(foo)s insert into test(foo) values (?)iis!select foo from test order by foois$Basic test of Connection.executemanyi(i(i(RR&R)RgR�R(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckConnectionExecutemany�s
cCsLtjd�}|jd�|jd�j�d}|j|dd�dS(Ns:memory:s9create table test(foo); insert into test(foo) values (5);sselect foo from testiis&Basic test of Connection.executescript(RR&R�R)RIR(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckConnectionExecutescript�s
(	R"R#R�R�R�R�R�R�R�(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR��s	
		
	
		tClosedConTestscBskeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(cCsdS(N((R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR+�scCsdS(N((R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR-�scCsdtjd�}|j�y|j�}|jd�Wn'tjk
rLn|jd�nXdS(Ns:memory:s%Should have raised a ProgrammingError(RR&R,R(R5R(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedConCursor�s
cCsbtjd�}|j�y|j�|jd�Wn'tjk
rJn|jd�nXdS(Ns:memory:s%Should have raised a ProgrammingError(RR&R,R.R5R(RR7((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedConCommit�s

cCsbtjd�}|j�y|j�|jd�Wn'tjk
rJn|jd�nXdS(Ns:memory:s%Should have raised a ProgrammingError(RR&R,R1R5R(RR7((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedConRollback�s

cCsqtjd�}|j�}|j�y|jd�|jd�Wn'tjk
rYn|jd�nXdS(Ns:memory:sselect 4s%Should have raised a ProgrammingError(RR&R(R,R)R5R(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedCurExecute�s

cCsttjd�}|j�d�}y$|jdd|�|jd�Wn'tjk
r\n|jd�nXdS(Ns:memory:cSsdS(Ni((RT((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�sR%is%Should have raised a ProgrammingError(RR&R,tcreate_functionR5R(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedCreateFunction	s
	cCs~tjd�}|j�ddd��Y}y$|jdd|�|jd�Wn'tjk
rfn|jd�nXdS(Ns:memory:tAggcBs#eZd�Zd�Zd�ZRS(cSsdS(N((R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyRoscSsdS(N((RRT((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytstepscSsdS(Ni((R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytfinalizes(R"R#RoR�R�(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�s		R%is%Should have raised a ProgrammingError((RR&R,tcreate_aggregateR5R(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedCreateAggregates
cCsntjd�}|j�d�}y|j|�|jd�Wn'tjk
rVn|jd�nXdS(Ns:memory:cWstjS(N(RtDENY(targs((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt
authorizer*ss%Should have raised a ProgrammingError(RR&R,tset_authorizerR5R(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedSetAuthorizer's
	
cCsqtjd�}|j�d�}y!|j|d�|jd�Wn'tjk
rYn|jd�nXdS(Ns:memory:cSsdS(N((((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytprogress7sids%Should have raised a ProgrammingError(RR&R,tset_progress_handlerR5R(RR7R�((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedSetProgressCallback4s
	cCs_tjd�}|j�y|�|jd�Wn'tjk
rGn|jd�nXdS(Ns:memory:s%Should have raised a ProgrammingError(RR&R,R5R(RR7((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedCall@s
(
R"R#R+R-R�R�R�R�R�R�R�R�R�(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR��s									
	tClosedCurTestscBs#eZd�Zd�Zd�ZRS(cCsdS(N((R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR+LscCsdS(N((R((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR-OscCs�tjd�}|j�}|j�x�dD]�}|dkrGd}n'|dkrhd	ddgf}ng}y.t||�}||�|jd|�Wq,tjk
r�q,|jd
|�q,Xq,WdS(Ns:memory:R)RgR�R�R�RIsselect 4 union select 5sinsert into foo(bar) values (?)iis.Should have raised a ProgrammingError: method s'Should have raised a ProgrammingError: (sexecutesexecutemanys
executescriptsfetchalls	fetchmanysfetchone(sexecutes
executescript(sselect 4 union select 5(i(i(RR&R(R,tgetattrR5R(RR7R�tmethod_nametparamstmethod((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytCheckClosedRs"

	
(R"R#R+R-R�(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyR�Ks		c	Cs�tjtd�}tjtd�}tjtd�}tjtd�}tjtd�}tjtd�}tjtd�}tjt	d�}tj
||||||||f�S(NtCheck(tunittestt	makeSuiteRR$R;R�R�R�R�R�t	TestSuite(tmodule_suitetconnection_suitetcursor_suitetthread_suitetconstructor_suitet	ext_suitetclosed_con_suitetclosed_cur_suite((s(/sys/lib/python2.7/sqlite3/test/dbapi.pytsuiteiscCs tj�}|jt��dS(N(R�tTextTestRunnerR�R�(trunner((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyttesttst__main__(R�R]tsqlite3RR�tImportErrorR�tTestCaseRR$R;t
skipUnlessR�R�R�R�R�R�R�R"(((s(/sys/lib/python2.7/sqlite3/test/dbapi.pyt<module>s(

79��Cv		

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.