%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/sqlite3/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/sqlite3/test/hooks.pyc


Oac@sddlZddlZddlZdejfdYZdejfdYZdZdZe	dkr~endS(	iNtCollationTestscBsbeZdZdZdZdZdZdZdZdZ	dZ
d	ZRS(
cCsdS(N((tself((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytsetUpscCsdS(N((R((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyttearDownscCs<tjd}|jt|jddWdQXdS(Ns:memory:cSs||k||kS(N((txty((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyt<lambda>%t(tsqlitetconnecttassertRaisest	TypeErrortcreate_collationtNone(Rtcon((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckCreateCollationNotString"scCsatjd}y!|jdd|jdWn*tk
r\}|j|jddnXdS(Ns:memory:tXi*sshould have raised a TypeErrorisparameter must be callable(RR	RtfailRtassertEqualtargs(RRte((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckCreateCollationNotCallable'scCsMtjd}y!|jdt|jdWntjk
rH}nXdS(Ns:memory:scolls%should have raised a ProgrammingError(RR	RtcmpRtProgrammingError(RRR((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckCreateCollationNotAscii/scCsdtfdY}tjd}d}|j|d||jdj}|j|ddd|j|d	dd
dS(NtBadUpperStrcBseZdZRS(cSsdS(N(R
(R((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytupper9s(t__name__t
__module__R(((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyR8ss:memory:cSs||k||kS(N((RR((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyR<Rtmycolls
            select x from (
            select 'a' as x
            union
            select 'b' as x
            ) order by x collate mycoll
            itbita(tstrRR	RtexecutetfetchallR(RRRRtresult((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckCreateCollationBadUpper7s	cCstjdkrdSd}tjd}|jd|d}|j|j}|ddd	ks|ddd
ks|dddkr|jdn|jddy&|j|j}|jd
Wn3tjk
r
}|j	|j
djdnXdS(NiiicSst||S(N(R(RR((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyRKss:memory:Rs
            select x from (
            select 'a' as x
            union
            select 'b' as x
            union
            select 'c' as x
            ) order by x collate mycoll
            itcRRs#the expected order was not returneds&should have raised an OperationalErrors"no such collation sequence: mycoll(iii(Rtversion_infoR	RR!R"RR
tOperationalErrorRRtlower(RRRtsqlR#R((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckCollationIsUsedHs		<cCsfd}tjd}|jd|d}|j|j}|j|d
ddgdd	dS(
NcSs||k||kdS(Nii I((RR((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyRfss:memory:Rs
            select x from (
            select 'a' as x
            union
            select 'b' as x
            union
            select 'c' as x
            ) order by x collate mycoll
            R%RRtmsgs#the expected order was not returned(R%(R(R(RR	RR!R"R(RRRR)R#((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyt!CheckCollationReturnsLargeIntegeres		cCstjd}|jdt|jdd|jdj}|dddkso|dddkr|jd	nd
S(s
        Register two different collation functions under the same name.
        Verify that the last one is actually used.
        s:memory:RcSst||S(N(R(RR((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyRRsi
            select x from (select 'a' as x union select 'b' as x) order by x collate mycoll
            iRiRs wrong collation function is usedN(RR	RRR!R"R(RRR#((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckCollationRegisterTwicexs(cCstjd}|jdt|jddy|jd|jdWn<tjk
r}|jdj	ds|jdqnXdS(	su
        Register a collation, then deregister it. Make sure an error is raised if we try
        to use it.
        s:memory:Rs?select 'a' as x union select 'b' as x order by x collate mycolls&should have raised an OperationalErrorisno such collation sequenceswrong OperationalError raisedN(
RR	RRR
R!RR'Rt
startswith(RRR((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckDeregisterCollations
(RRRRRRRR$R*R,R-R/(((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyRs									t
ProgressTestscBs,eZdZdZdZdZRS(csRtjd}gfd}|j|d|jd|jdS(sK
        Test that the progress handler is invoked once it is set.
        s:memory:csjddS(Ni(tappendR
((tprogress_calls(s./usr/local/lib/python2.7/sqlite3/test/hooks.pytprogresss
is0
            create table foo(a, b)
            N(RR	tset_progress_handlerR!t
assertTrue(RRR3((R2s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckProgressHandlerUsedscstjd}gfd}|j|d|j}|jdt}g|j|d|jdt}|j||dS(s=
        Test that the opcode argument is respected.
        s:memory:csjddS(Ni(R1R
((R2(s./usr/local/lib/python2.7/sqlite3/test/hooks.pyR3s
is1
            create table foo (a, b)
            is1
            create table bar (a, b)
            N(RR	R4tcursorR!tlentassertGreaterEqual(RRR3tcurstfirst_counttsecond_count((R2s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckOpcodeCountscs]tjd}gfd}|j|d|j}|jtj|jddS(sW
        Test that returning a non-zero value stops the operation in progress.
        s:memory:csjddS(Ni(R1R
((R2(s./usr/local/lib/python2.7/sqlite3/test/hooks.pyR3s
iscreate table bar (a, b)N(RR	R4R7R
R'R!(RRR3R:((R2s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckCancelOperationscsttjd}gfd}|j|d|jdd|jdj|jtdddS(sc
        Test that setting the progress handler to None clears the previously set handler.
        s:memory:csjddS(Nii(R1((taction(s./usr/local/lib/python2.7/sqlite3/test/hooks.pyR3s
is&select 1 union select 2 union select 3is progress handler was not clearedN(RR	R4R
R!R"RR8(RRR3((R?s./usr/local/lib/python2.7/sqlite3/test/hooks.pytCheckClearHandlers(RRR6R=R>R@(((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyR0s			cCs7tjtd}tjtd}tj||fS(NtCheck(tunittestt	makeSuiteRR0t	TestSuite(tcollation_suitetprogress_suite((s./usr/local/lib/python2.7/sqlite3/test/hooks.pytsuitescCs tj}|jtdS(N(RBtTextTestRunnertrunRG(trunner((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyttestst__main__(
tosRBtsqlite3RtTestCaseRR0RGRKR(((s./usr/local/lib/python2.7/sqlite3/test/hooks.pyt<module>szF		

Zerion Mini Shell 1.0