tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
X\¬Qc@s‚ddlZddlZddlZdejfd„ƒYZdejfd„ƒYZd„Zd„Ze    dkr~eƒndS(    iÿÿÿÿNtCollationTestscBsPeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    RS(cCsdS(N((tself((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytsetUpscCsdS(N((R((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyttearDownscCsatjdƒ}y!|jddƒ|jdƒWn*tk
r\}|j|jddƒnXdS(Ns:memory:tXi*sshould have raised a TypeErrorisparameter must be callable(tsqlitetconnecttcreate_collationtfailt    TypeErrort assertEqualtargs(Rtconte((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckCreateCollationNotCallable"s cCsMtjdƒ}y!|jdtƒ|jdƒWntjk
rH}nXdS(Ns:memory:scolläs%should have raised a ProgrammingError(RRRtcmpRtProgrammingError(RR R ((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckCreateCollationNotAscii*s cCstjdkrdSd„}tjdƒ}|jd|ƒd}|j|ƒjƒ}|ddd    ks’|ddd
ks’|ddd kr¢|jd ƒn|jddƒy&|j|ƒjƒ}|jd ƒWn3tjk
r }|j    |j
dj ƒdƒnXdS(NiiicSst||ƒ S(N(R(txty((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytmycoll5ss:memory:RsÉ
            select x from (
            select 'a' as x
            union
            select 'b' as x
            union
            select 'c' as x
            ) order by x collate mycoll
            itctbtas#the expected order was not returneds&should have raised an OperationalErrors"no such collation sequence: mycoll(iii( Rt version_infoRRtexecutetfetchallRtNonetOperationalErrorR
R tlower(RRR tsqltresultR ((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckCollationIsUsed2s        <cCsfd„}tjdƒ}|jd|ƒd}|j|ƒjƒ}|j|d
d d gdd    ƒdS( NcSs||k||k dS(Nii I((RR((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyRPss:memory:RsÉ
            select x from (
            select 'a' as x
            union
            select 'b' as x
            union
            select 'c' as x
            ) order by x collate mycoll
            RRRtmsgs#the expected order was not returned(R(R(R(RRRRRR
(RRR RR((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyt!CheckCollationReturnsLargeIntegerOs        cCsƒtjdƒ}|jdtƒ|jdd„ƒ|jdƒjƒ}|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((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyt<lambda>issi
            select x from (select 'a' as x union select 'b' as x) order by x collate mycoll
            iRiRs wrong collation function is usedN(RRRRRRR(RR R((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckCollationRegisterTwicebs(cCstjdƒ}|jdtƒ|jddƒy|jdƒ|jdƒWn<tjk
r‹}|jdj    dƒsŒ|jdƒqŒnXdS(    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(
RRRRRRRRR t
startswith(RR R ((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckDeregisterCollationps (
t__name__t
__module__RRRRR R"R$R&(((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyRs                            t ProgressTestscBs,eZd„Zd„Zd„Zd„ZRS(csRtjdƒ}g‰‡fd†}|j|dƒ|jdƒ|jˆƒdS(sK
        Test that the progress handler is invoked once it is set.
        s:memory:csˆjdƒdS(Ni(tappendR((tprogress_calls(sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytprogress†s is0
            create table foo(a, b)
            N(RRtset_progress_handlerRt
assertTrue(RR R,((R+sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckProgressHandlerUsed€scsŸtjdƒ}g‰‡fd†}|j|dƒ|jƒ}|jdƒtˆƒ}g‰|j|dƒ|jdƒtˆƒ}|j||kƒdS(s=
        Test that the opcode argument is respected.
        s:memory:csˆjdƒdS(Ni(R*R((R+(sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyR,–s is1
            create table foo (a, b)
            is1
            create table bar (a, b)
            N(RRR-tcursorRtlenR.(RR R,tcurst first_countt second_count((R+sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckOpcodeCounts   cs]tjdƒ}g‰‡fd†}|j|dƒ|jƒ}|jtj|jdƒdS(sW
        Test that returning a non-zero value stops the operation in progress.
        s:memory:csˆjdƒdS(Ni(R*R((R+(sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyR,­s iscreate table bar (a, b)N(RRR-R0t assertRaisesRR(RR R,R2((R+sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckCancelOperation§s csttjdƒ}g‰‡fd†}|j|dƒ|jddƒ|jdƒjƒ|jtˆƒddƒdS(sc
        Test that setting the progress handler to None clears the previously set handler.
        s:memory:csˆjdƒdS(Nii(R*((taction(sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyR,½s is&select 1 union select 2 union select 3is progress handler was not clearedN(RRR-RRRR
R1(RR R,((R8sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytCheckClearHandler·s(R'R(R/R5R7R9(((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyR)s            cCs7tjtdƒ}tjtdƒ}tj||fƒS(NtCheck(tunittestt    makeSuiteRR)t    TestSuite(tcollation_suitetprogress_suite((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pytsuiteÅscCs tjƒ}|jtƒƒdS(N(R;tTextTestRunnertrunR@(trunner((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyttestÊs t__main__(
tosR;tsqlite3RtTestCaseRR)R@RDR'(((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/hooks.pyt<module>s dF