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

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


��Qc@s�ddlZddlZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zdd-d��YZdd.d��YZdd/d��YZdd0d��YZdd1d��YZdd2d��YZdd3d��YZdejfd��YZd ejfd!��YZd"ejfd#��YZd$efd%��YZd&efd'��YZd(efd)��YZd*�Zd+�Z e!d,kr�e �ndS(4i�NcCsdS(Ntfoo((((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_returntextscCsdS(Nubar((((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_returnunicodescCsdS(Ni*((((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_returnint scCsdS(Ng�Q�	@((((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_returnfloat"scCsdS(N(tNone(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_returnnull$scCs
td�S(Ntblob(tbuffer(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_returnblob&scCsdS(Niil((((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_returnlonglong(scCsdddS(Nii((((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_raiseexception*scCst|�tkS(N(ttypetunicode(tv((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyt
func_isstring-scCst|�tkS(N(Rtint(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyt
func_isint/scCst|�tkS(N(Rtfloat(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_isfloat1scCst|�td�kS(N(RR(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_isnone3scCst|�tkS(N(RR(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_isblob5scCst|ttf�o|dkS(Niil(t
isinstanceRtlong(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfunc_islonglong7st
AggrNoStepcBseZd�Zd�ZRS(cCsdS(N((tself((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyt__init__;scCsdS(Ni((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytfinalize>s(t__name__t
__module__RR(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR:s	tAggrNoFinalizecBseZd�Zd�ZRS(cCsdS(N((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRBscCsdS(N((Rtx((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytstepEs(RRRR!(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRAs	tAggrExceptionInInitcBs#eZd�Zd�Zd�ZRS(cCsdddS(Nii((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRIscCsdS(N((RR ((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR!LscCsdS(N((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyROs(RRRR!R(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR"Hs		tAggrExceptionInStepcBs#eZd�Zd�Zd�ZRS(cCsdS(N((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRSscCsdddS(Nii((RR ((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR!VscCsdS(Ni*((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRYs(RRRR!R(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR#Rs		tAggrExceptionInFinalizecBs#eZd�Zd�Zd�ZRS(cCsdS(N((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR]scCsdS(N((RR ((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR!`scCsdddS(Nii((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRcs(RRRR!R(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR$\s		t
AggrCheckTypecBs#eZd�Zd�Zd�ZRS(cCs
d|_dS(N(Rtval(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRgscCsRitd6td6td6td�d6td6}t||t|�k�|_dS(NtstrRRRR(R
RRRRRR&(Rt	whichTypeR&ttheType((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR!js/cCs|jS(N(R&(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRns(RRRR!R(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR%fs		tAggrSumcBs#eZd�Zd�Zd�ZRS(cCs
d|_dS(Ng(R&(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRrscCs|j|7_dS(N(R&(RR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR!uscCs|jS(N(R&(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRxs(RRRR!R(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR*qs		t
FunctionTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(cCsJtjd�|_|jjddt�|jjddt�|jjddt�|jjddt�|jjddt�|jjddt	�|jjd	dt
�|jjd
dt�|jjddt�|jjd
dt
�|jjddt�|jjddt�|jjddt�|jjddt�dS(Ns:memory:t
returntextit
returnunicodet	returninttreturnfloatt
returnnullt
returnblobtreturnlonglongtraiseexceptiontisstringitisinttisfloattisnonetisblobt
islonglong(tsqlitetconnecttcontcreate_functionRRRRRR	R
RRRRRRR(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytsetUp|scCs|jj�dS(N(R<tclose(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyttearDown�scCsEy*|jjddd��|jd�Wntjk
r@nXdS(Ntblai��Ssd|S(Ni((R ((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyt<lambda>�ss&should have raised an OperationalError(R<R=tfailR:tOperationalError(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncErrorOnCreate�s
cCsUd�}|�}|t�d<|jjdd|�|jj�}|jd�dS(NcSs
d�}|S(NcSsdS(Ni((((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytf�s((RF((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytgetfunc�s	Rtreftestisselect reftest()(tglobalsR<R=tcursortexecute(RRGRFtcur((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncRefCount�s		
cCsV|jj�}|jd�|j�d}|jt|�t�|j|d�dS(Nsselect returntext()iR(R<RJRKtfetchonetassertEqualRR
(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncReturnText�s

cCsV|jj�}|jd�|j�d}|jt|�t�|j|d�dS(Nsselect returnunicode()iubar(R<RJRKRNRORR
(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncReturnUnicode�s

cCsV|jj�}|jd�|j�d}|jt|�t�|j|d�dS(Nsselect returnint()ii*(R<RJRKRNRORR(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncReturnInt�s

cCsn|jj�}|jd�|j�d}|jt|�t�|dksZ|dkrj|jd�ndS(Nsselect returnfloat()ig��	@gS㥛�	@swrong value(R<RJRKRNRORRRC(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncReturnFloat�s
cCs\|jj�}|jd�|j�d}|jt|�td��|j|d�dS(Nsselect returnnull()i(R<RJRKRNRORR(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncReturnNull�s

cCs\|jj�}|jd�|j�d}|jt|�t�|j|td��dS(Nsselect returnblob()iR(R<RJRKRNRORR(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncReturnBlob�s

cCs@|jj�}|jd�|j�d}|j|d�dS(Nsselect returnlonglong()iiil(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncReturnLongLong�s
cCsk|jj�}y(|jd�|j�|jd�Wn-tjk
rf}|j|jdd�nXdS(Nsselect raiseexception()s#should have raised OperationalErroris&user-defined function raised exception(	R<RJRKRNRCR:RDROtargs(RRLte((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckFuncException�s

cCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect isstring(?)Rii(sfoo(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckParamString�scCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect isint(?)i*ii(i*(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyt
CheckParamInt�scCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect isfloat(?)g�Q�	@ii(g�Q�	@(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckParamFloat�scCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect isnone(?)ii(N(R<RJRKRRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckParamNone�scCsL|jj�}|jdtd�f�|j�d}|j|d�dS(Nsselect isblob(?)Rii(R<RJRKRRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckParamBlob�scCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect islonglong(?)ii*il(l(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckParamLongLong�s(RRR>R@RERMRPRQRRRSRTRURVRYRZR[R\R]R^R_(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR+{s$																		tAggregateTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(cCs�tjd�|_|jj�}|jd�|jdddddtd�f�|jjdd	t�|jjd
d	t	�|jjdd	t
�|jjdd	t�|jjd
d	t�|jjddt
�|jjdd	t�dS(Ns:memory:s�
            create table test(
                t text,
                i integer,
                f float,
                n,
                b blob
                )
            s6insert into test(t, i, f, n, b) values (?, ?, ?, ?, ?)Rig�Q�	@Rtnostepit
nofinalizetexcInittexcSteptexcFinalizet	checkTypeitmysum(R:R;R<RJRKRRtcreate_aggregateRRR"R#R$R%R*(RRL((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR>s	cCsdS(N((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR@scCsBy'|jjddt�|jd�Wntjk
r=nXdS(NRAi��should have raised an OperationalError(R<R=R*RCR:RD(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrErrorOnCreate s
cCs^|jj�}y|jd�|jd�Wn*tk
rY}|j|jdd�nXdS(Nsselect nostep(t) from tests$should have raised an AttributeErroris+AggrNoStep instance has no attribute 'step'(R<RJRKRCtAttributeErrorRORW(RRLRX((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrNoStep's
cCsq|jj�}y.|jd�|j�d}|jd�Wn-tjk
rl}|j|jdd�nXdS(Nsselect nofinalize(t) from testis&should have raised an OperationalErrors7user-defined aggregate's 'finalize' method raised error(	R<RJRKRNRCR:RDRORW(RRLR&RX((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrNoFinalize/s
cCsq|jj�}y.|jd�|j�d}|jd�Wn-tjk
rl}|j|jdd�nXdS(Nsselect excInit(t) from testis&should have raised an OperationalErrors7user-defined aggregate's '__init__' method raised error(	R<RJRKRNRCR:RDRORW(RRLR&RX((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrExceptionInInit8s
cCsq|jj�}y.|jd�|j�d}|jd�Wn-tjk
rl}|j|jdd�nXdS(Nsselect excStep(t) from testis&should have raised an OperationalErrors3user-defined aggregate's 'step' method raised error(	R<RJRKRNRCR:RDRORW(RRLR&RX((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrExceptionInStepAs
cCsq|jj�}y.|jd�|j�d}|jd�Wn-tjk
rl}|j|jdd�nXdS(Nsselect excFinalize(t) from testis&should have raised an OperationalErrors7user-defined aggregate's 'finalize' method raised error(	R<RJRKRNRCR:RDRORW(RRLR&RX((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrExceptionInFinalizeJs
cCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect checkType('str', ?)Rii(sfoo(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrCheckParamStrSscCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect checkType('int', ?)i*ii(i*(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrCheckParamIntYscCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect checkType('float', ?)g�Q�	@ii(g�Q�	@(R<RJRKRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrCheckParamFloat_scCsC|jj�}|jdd�|j�d}|j|d�dS(Nsselect checkType('None', ?)ii(N(R<RJRKRRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrCheckParamNoneescCsL|jj�}|jdtd�f�|j�d}|j|d�dS(Nsselect checkType('blob', ?)Rii(R<RJRKRRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrCheckParamBlobkscCsf|jj�}|jd�|jdd	d
dg�|jd�|j�d}|j|d�dS(Nsdelete from testsinsert into test(i) values (?)i
iisselect mysum(i) from testii<(i
(i(i(R<RJRKtexecutemanyRNRO(RRLR&((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytCheckAggrCheckAggrSumqs

(RRR>R@RiRkRlRmRnRoRpRqRrRsRtRv(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR`s																	tAuthorizerTestscBs;eZed��Zd�Zd�Zd�Zd�ZRS(cCs<|tjkrtjS|dks.|dkr5tjStjS(Ntc2tt2(R:t
SQLITE_SELECTtSQLITE_DENYt	SQLITE_OK(tactiontarg1targ2tdbnametsource((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyt
authorizer_cbzs
cCsItjd�|_|jjd�|jjd�|jj|j�dS(Ns:memory:s�
            create table t1 (c1, c2);
            create table t2 (c1, c2);
            insert into t1 (c1, c2) values (1, 2);
            insert into t2 (c1, c2) values (4, 5);
            sselect c2 from t2(R:R;R<t
executescriptRKtset_authorizerR�(R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR>�s
	cCsdS(N((R((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR@�scCspy|jjd�WnHtjk
r^}|jdjd�sZ|jd|jd�ndSX|jd�dS(Nsselect * from t2it
prohibitedswrong exception text: %ss9should have raised an exception due to missing privileges(R<RKR:t
DatabaseErrorRWtendswithRC(RRX((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyttest_table_access�scCspy|jjd�WnHtjk
r^}|jdjd�sZ|jd|jd�ndSX|jd�dS(Nsselect c2 from t1iR�swrong exception text: %ss9should have raised an exception due to missing privileges(R<RKR:R�RWR�RC(RRX((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyttest_column_access�s(RRtstaticmethodR�R>R@R�R�(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyRwys
				tAuthorizerRaiseExceptionTestscBseZed��ZRS(cCs@|tjkrt�n|dks0|dkr9t�ntjS(NRxRy(R:Rzt
ValueErrorR|(R}R~RR�R�((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR��s
		(RRR�R�(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR��stAuthorizerIllegalTypeTestscBseZed��ZRS(cCs6|tjkrdS|dks+|dkr/dStjS(NgRxRy(R:RzR|(R}R~RR�R�((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR��s
(RRR�R�(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR��stAuthorizerLargeIntegerTestscBseZed��ZRS(cCs6|tjkrdS|dks+|dkr/dStjS(Nii RxRyll(R:RzR|(R}R~RR�R�((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR��s
(RRR�R�(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyR��scCsmtjtd�}tjtd�}tjt�}tj|||tjt�tjt�tjt�f�S(NtCheck(	tunittestt	makeSuiteR+R`Rwt	TestSuiteR�R�R�(tfunction_suitetaggregate_suitetauthorizer_suite((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pytsuite�scCs tj�}|jt��dS(N(R�tTextTestRunnertrunR�(trunner((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyttest�st__main__(((((((("R�tsqlite3R:RRRRRR	R
RRRRRRRRRR"R#R$R%R*tTestCaseR+R`RwR�R�R�R�R�R(((s0/sys/lib/python2.7/sqlite3/test/userfunctions.pyt<module>s@														



�v,		
	
	

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.