��Qc@smdZddlZddlZddlZddlZddlmZddlZddlmZm Z m
Z
mZmZm
Z
i7d�d6d�d6d�d6d�d6d�d6d�d6d�d6d�d6d�d!6d�d$6d�d'6d�d*6d�d-6d�d06d�d36d�d66d�d96d�d<6d�d>6d�d@6d�dB6d�dD6d�dG6d�dI6d�dK6d�dM6d�dO6d�dQ6d�dS6d�dU6d�dW6d�d[6d�d]6d�d_6d�da6d�dc6d�de6d�dh6d�dj6d�dn6d�dp6d�dr6d�du6d�dw6d�y6d�|6d�6d��6d��6d��6d��6d��6d��6d��6d��6Zd�ejfd���YZd�ejfd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd�efd���YZd��Zed�kriej d�d��ndS(�s
TestCases for DB.associate.
i�N(tpprint(tdbtdbshelvettest_supporttverbosethave_threadstget_new_environment_pathsBad EnglishsThe Price Of LovetRockisDNA featuring Suzanne VegasTom's DinerisGeorge MichaelsPraying For TimeisGloria EstefansHere We AreisLinda RonstadtsDon't Know MuchisMichael Boltons%How Am I Supposed To Live Without YoutBluesis
Paul YoungsOh GirlisPaula AbdulsOpposites AttractisRichard MarxsShould've Known Betteri sRod Stewarts
Forever Youngi
tRoxettet Dangerousis
Sheena EastonsThe Lover In MeisSinead O'ConnorsNothing Compares 2 Ui
s Stevie B.sBecause I Love YouisTaylor DaynesLove Will Lead You BackisThe Bangless
Eternal FlameisWilson Phillipss
Release Meis
Billy JoelsBlonde Over BlueisFamous Last WordsisLullabye (Goodnight, My Angel)isThe River Of DreamsisTwo Thousand Yearsis
Janet JacksontAlrightis Black CatisCome Back To MeitEscapadeis Love Will Never Do (Without You)is
Miss You Muchis
Rhythm NationisState Of The Worldis
The Knowledgeis
Spyro GyrasEnd of RomanticismtJazzi t
Heliopolisi!tJubileei"sLittle Lindai#s
Morning Dancei$sSong for Lorrainei%tYessOwner Of A Lonely Hearti&sRhythm Of Lovei'tCuscos
Dream CatchersNew Agei(sGeronimos Laughteri)sGhost Dancei*sBlue Man GrouptDrumbonei+sEndless Columni,sKlein Mandelbroti-sKenny Gt
Silhouettei.tSadesSmooth Operatori/sDavid Arkenstones(Papillon (On The Wings Of The Butterfly)i0sStepping Starsi1sCarnation Lily Lily Rosei2s
David LanzsBehind The Waterfalli3sCristofori's Dreami4tHeartsoundsi5sLeaves on the Seinei6sunknown artistsUnnamed songtUnknownictAssociateErrorTestCasecBs#eZd�Zd�Zd�ZRS(cCsR|jjd|_t�|_tj�|_|jj|jtj tj
B�dS(Ns.db(t __class__t__name__tfilenameRthomeDirRtDBEnvtenvtopent DB_CREATEt
DB_INIT_MPOOL(tself((s//sys/lib/python2.7/bsddb/test/test_associate.pytsetUpOscCs*|jj�d|_tj|j�dS(N(RtclosetNoneRtrmtreeR(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyttearDownUs
cCstr%dGddGHd|jjGHntj|j�}|jtj�|j|j dtj
tj�tj|j�}|j|j dtj
tj�yd�}|j||�Wn(tj
k
r�|j�|j�n"X|j�|j�|jd�dS( Ns
s-=is%Running %s.test00_associateDBError...tprimaryt secondarycSs||S(N((tatb((s//sys/lib/python2.7/bsddb/test/test_associate.pytfjssDBError exception was expected(RRRRtDBRt set_flagstDB_DUPRRtDB_BTREERt associatetDBErrorR#tfail(R!tdupDBtsecDBR+((s//sys/lib/python2.7/bsddb/test/test_associate.pyttest00_associateDBErrorZs$
(Rt
__module__R"R&R5(((s//sys/lib/python2.7/bsddb/test/test_associate.pyRNs tAssociateTestCasecBs�eZdZdZdZd�Zd�Zdd�Zdd�Z d�Z
d�Zd�Zd �Z
d
�Zd�Zej�dkr�d�Zd�Zndd�Zd�Zd�ZRS(ticCsg|jjd|_t�|_tj�|_|jj|jtj tj
BtjBtjB|j
B�dS(Ns.db(RRRRRRRRRRR tDB_INIT_LOCKt DB_THREADtenvFlags(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyR"s
cCs4|j�|jj�d|_tj|j�dS(N(tcloseDBRR#R$RR%R(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyR&�s
cCshxatj�D]S\}}t|j�td�krAd|}n|j|dj|�d|�q
WdS(NR8s%02dt|ttxn(t musicdatatitemsttypetkeytypetputtjoin(R!tdR>tkeytvalue((s//sys/lib/python2.7/bsddb/test/test_associate.pytaddDataToDB�s
cCsqd|_d|_tj|j�|_|jjd�|jj|j d|j
tjtjB|j
Bd|�dS(NiR'R>(R$tcurR4RR,RR'tset_get_returns_noneRRtdbtypeRR:tdbFlags(R!R>((s//sys/lib/python2.7/bsddb/test/test_associate.pytcreateDB�s cCs^|jr"|jj�d|_n|jrD|jj�d|_n|jj�d|_dS(N(RIR#R$R4R'(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyR<�s
cCs|jS(N(R'(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pytgetDB�scCs�|j�tj|j�|_|jjtj�|jjd�|jj|j dtj
tjtjB|j
B�|j�j|j|�|j|j��|j|j�dS(NiR((RMRR,RR4R-R.RJRRR/RR:RLRNR0RHtfinish_test(R!tgetGenre((s//sys/lib/python2.7/bsddb/test/test_associate.pyt_associateWithDB�s
cCs5tr%dGddGHd|jjGHn|j|j�S(Ns
s-=is$Running %s.test01_associateWithDB...(RRRRQRP(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyttest01_associateWithDB�s
cCs�|j�|j|j��tj|j�|_|jjtj�|jj |j
dtjtjtj
B|jB�|j�j|j|tj�|j|j�dS(NR((RMRHRNRR,RR4R-R.RRR/RR:RLR0RO(R!RP((s//sys/lib/python2.7/bsddb/test/test_associate.pyt_associateAfterDB�s
cCs5tr%dGddGHd|jjGHn|j|j�S(Ns
s-=is%Running %s.test02_associateAfterDB...(RRRRSRP(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyttest02_associateAfterDB�s
iicCs5tr%dGddGHd|jjGHn|j|j�S(Ns
s-=is$Running %s.test03_associateWithDB...(RRRRQtgetGenreList(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyttest03_associateWithDB�s
cCs5tr%dGddGHd|jjGHn|j|j�S(Ns
s-=is%Running %s.test04_associateAfterDB...(RRRRSRU(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyttest04_associateAfterDB�s
cCs�|jdd|�}|j|d|�|jdd|�}|j|ddkp`|ddk|�|djd�|djd�|djd �tr�d
GHn|j�j|�|_d}|jj �}x�|dk rvt
|j�t
d�kr|jt|d��n-|j|doBt
|d�t
d�k�|d}tr^|GHnt
|jd��}q�W|j|tt��tr�d
GHn|j|�|_d}|jjddtj�}|j|ddkp�ddk|�|j|dd�|djd�|djd�|djd �|jjddddtj�}|j|d|�|jj �}|j|dd�x=|dk r�|d}tr�|GHnt
|jd��}q�W|j|tt�d�d|_dS(NRR>Riict99itUnnamedtunknownsPrimary key traversal:R8tnextsSecondary key traversal:tflagsitdataswrong valueR
(tpgettassertEqualR$t
assertTruetindexRRNtcursorRItfirstRARBtinttgetattrtlenR?RtDB_LASTtDB_GET_BOTH(R!R4R>tvalstcounttrec((s//sys/lib/python2.7/bsddb/test/test_associate.pyRO�sT*-
*!
cCsb|jt|�td��|jd�d}trGd||fGHn|dkrZtjS|SdS(NR8R=isgetGenre key: %r data: %rR(R_RAtsplitRRt
DB_DONOTINDEX(R!tpriKeytpriDatatgenre((s//sys/lib/python2.7/bsddb/test/test_associate.pyRPscCs:|j||�}t|�td�kr6|g}n|S(NR8(RPRA(R!RntPriDatatv((s//sys/lib/python2.7/bsddb/test/test_associate.pyRU*sN(ii(RR6RBR;RLR"R&R$RHRMR<RNRQRRRSRTRtversionRVRWRORPRU(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR7zs&
8 tAssociateHashTestCasecBseZejZRS((RR6RtDB_HASHRK(((s//sys/lib/python2.7/bsddb/test/test_associate.pyRt4stAssociateBTreeTestCasecBseZejZRS((RR6RR/RK(((s//sys/lib/python2.7/bsddb/test/test_associate.pyRv7stAssociateRecnoTestCasecBseZejZdZRS(i(RR6RtDB_RECNORKRB(((s//sys/lib/python2.7/bsddb/test/test_associate.pyRw:s tAssociateBTreeTxnTestCasecBs)eZejZdZd�Zd�ZRS(icCsTz|j|d|�Wd|jr<|jj�d|_n|rO|j�nXdS(NR>(RORIR#R$tcommit(R!tsDBR>((s//sys/lib/python2.7/bsddb/test/test_associate.pyttxn_finish_testDs
cCstr%dGddGHd|jjGHn|jj�}y�|jd|�tj|j�|_|jj tj
�|jjd�|jj|j
dtjtjtjBd|�|j�j|j|jd|�|j|j�d|�Wn|j��nX|j|jd|�dS(Ns
s-=is(Running %s.test13_associateAutoCommit...R>iR((RRRRt txn_beginRMRR,R4R-R.RJRRR/RR:RNR0RPRHtabortR|(R!R>((s//sys/lib/python2.7/bsddb/test/test_associate.pyttest13_associate_in_transactionNs$
"
(RR6RtDB_INIT_TXNR;RLR|R(((s//sys/lib/python2.7/bsddb/test/test_associate.pyRy@s
tShelveAssociateTestCasecBs#eZd�Zd�Zd�ZRS(cCs1tj|jddd|jd|j�|_dS(NtdbnameR'tdbenvtfiletype(RRRRRKR'(R!((s//sys/lib/python2.7/bsddb/test/test_associate.pyRMks cCsYxRtj�D]D\}}t|j�td�krAd|}n|j||�q
WdS(NR8s%02d(R?R@RARBRC(R!RERFRG((s//sys/lib/python2.7/bsddb/test/test_associate.pyRHqs
cCsY|jt|�td��tr4d||fGHn|d}|dkrQtjS|SdS(NsgetGenre key: %r data: %riR((R_RARRRm(R!RnRoRp((s//sys/lib/python2.7/bsddb/test/test_associate.pyRPxs
(RR6RMRHRP(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR�is tShelveAssociateHashTestCasecBseZejZRS((RR6RRuRK(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��stShelveAssociateBTreeTestCasecBseZejZRS((RR6RR/RK(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��stShelveAssociateRecnoTestCasecBseZejZdZRS(i(RR6RRxRKRB(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��s tThreadedAssociateTestCasecBs#eZd�Zd�Zd�ZRS(cCs|td|jd|f�}td|jd|f�}|jt�|jt�|j�|j�|j�|j�dS(Nttargettargs(tThreadtwriter1twriter2t setDaemontTruetstartRD(R!REtt1tt2((s//sys/lib/python2.7/bsddb/test/test_associate.pyRH�s
cCsbx[tj�D]M\}}t|j�td�krAd|}n|j|dj|��q
WdS(NR8s%02dR=(R?R@RARBRCRD(R!RERFRG((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��s
cCsNxGtdd�D]6}d|}|gd}|j|dj|��qWdS(NidiXsz%2diR=(trangeRCRD(R!REtxRFRG((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��s
(RR6RHR�R�(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��s
tThreadedAssociateHashTestCasecBseZejZRS((RR6RRuRK(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��stThreadedAssociateBTreeTestCasecBseZejZRS((RR6RR/RK(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��stThreadedAssociateRecnoTestCasecBseZejZdZRS(i(RR6RRxRKRB(((s//sys/lib/python2.7/bsddb/test/test_associate.pyR��s cCstj�}|jtjt��|jtjt��|jtjt��|jtjt��|jtjt��|jtjt ��|jtjt
��|jtjt��tr|jtjt
��|jtjt��|jtjt��n|S(N(tunittestt TestSuitetaddTestt makeSuiteRRtRvRwRyR�R�R�RR�R�R�(tsuite((s//sys/lib/python2.7/bsddb/test/test_associate.pyt
test_suite�st__main__tdefaultTestR�(sBad EnglishsThe Price Of LoveR(sDNA featuring Suzanne VegasTom's DinerR(sGeorge MichaelsPraying For TimeR(sGloria EstefansHere We AreR(sLinda RonstadtsDon't Know MuchR(sMichael Boltons%How Am I Supposed To Live Without YousBlues(s
Paul YoungsOh GirlR(sPaula AbdulsOpposites AttractR(sRichard MarxsShould've Known BetterR(sRod Stewarts
Forever YoungR(R R
R(s
Sheena EastonsThe Lover In MeR(sSinead O'ConnorsNothing Compares 2 UR(s Stevie B.sBecause I Love YouR(sTaylor DaynesLove Will Lead You BackR(sThe Bangless
Eternal FlameR(sWilson Phillipss
Release MeR(s
Billy JoelsBlonde Over BlueR(s
Billy JoelsFamous Last WordsR(s
Billy JoelsLullabye (Goodnight, My Angel)R(s
Billy JoelsThe River Of DreamsR(s
Billy JoelsTwo Thousand YearsR(s
Janet JacksonRR(s
Janet Jacksons Black CatR(s
Janet JacksonsCome Back To MeR(s
Janet JacksonRR(s
Janet Jacksons Love Will Never Do (Without You)R(s
Janet Jacksons
Miss You MuchR(s
Janet Jacksons
Rhythm NationR(s
Janet JacksonsState Of The WorldR(s
Janet Jacksons
The KnowledgeR(s
Spyro GyrasEnd of RomanticismsJazz(s
Spyro GyraRsJazz(s
Spyro GyraRsJazz(s
Spyro GyrasLittle LindasJazz(s
Spyro Gyras
Morning DancesJazz(s
Spyro GyrasSong for LorrainesJazz(RsOwner Of A Lonely HeartR(RsRhythm Of LoveR(Rs
Dream CatchersNew Age(RsGeronimos LaughtersNew Age(RsGhost DancesNew Age(sBlue Man GroupRsNew Age(sBlue Man GroupsEndless ColumnsNew Age(sBlue Man GroupsKlein MandelbrotsNew Age(sKenny GRsJazz(RsSmooth OperatorsJazz(sDavid Arkenstones(Papillon (On The Wings Of The Butterfly)sNew Age(sDavid ArkenstonesStepping StarssNew Age(sDavid ArkenstonesCarnation Lily Lily RosesNew Age(s
David LanzsBehind The WaterfallsNew Age(s
David LanzsCristofori's DreamsNew Age(s
David LanzRsNew Age(s
David LanzsLeaves on the SeinesNew Age(sunknown artistsUnnamed songsUnknown(!t__doc__tsystoststringttimeRR�ttest_allRRRRRRR?tTestCaseRR7RtRvRwRyR�R�R�R�R�R�R�R�R�Rtmain(((s//sys/lib/python2.7/bsddb/test/test_associate.pyt<module>s�$.
,�)
|