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

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


��Qc@sddlZddlZdejfd��YZd�Zdejfd��YZdejfd��YZ	d	ejfd
��YZ
dejfd��YZd
ejfd��YZdejfd��YZ
dejfd��YZd�Zd�Zedkre�ndS(i�NtMyConnectioncBseZd�ZRS(cOstjj|||�dS(N(tsqlitet
Connectiont__init__(tselftargstkwargs((s*/sys/lib/python2.7/sqlite3/test/factory.pyRs(t__name__t
__module__R(((s*/sys/lib/python2.7/sqlite3/test/factory.pyRscCs<i}x/t|j�D]\}}||||d<qW|S(Ni(t	enumeratetdescription(tcursortrowtdtidxtcol((s*/sys/lib/python2.7/sqlite3/test/factory.pytdict_factorystMyCursorcBseZd�ZRS(cOs#tjj|||�t|_dS(N(RtCursorRRtrow_factory(RRR((s*/sys/lib/python2.7/sqlite3/test/factory.pyR&s(RRR(((s*/sys/lib/python2.7/sqlite3/test/factory.pyR%stConnectionFactoryTestscBs#eZd�Zd�Zd�ZRS(cCstjddt�|_dS(Ns:memory:tfactory(RtconnectRtcon(R((s*/sys/lib/python2.7/sqlite3/test/factory.pytsetUp+scCs|jj�dS(N(Rtclose(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyttearDown.scCs |jt|jt�d�dS(Ns*connection is not instance of MyConnection(t
assertTruet
isinstanceRR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckIsInstance1s(RRRRR(((s*/sys/lib/python2.7/sqlite3/test/factory.pyR*s		tCursorFactoryTestscBs#eZd�Zd�Zd�ZRS(cCstjd�|_dS(Ns:memory:(RRR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyR7scCs|jj�dS(N(RR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyR:scCs2|jjdt�}|jt|t�d�dS(NRs"cursor is not instance of MyCursor(RRRRR(Rtcur((s*/sys/lib/python2.7/sqlite3/test/factory.pyR=s(RRRRR(((s*/sys/lib/python2.7/sqlite3/test/factory.pyR6s		tRowFactoryTestsBackwardsCompatcBs#eZd�Zd�Zd�ZRS(cCstjd�|_dS(Ns:memory:(RRR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyRDscCsU|jjdt�}|jd�|j�}|jt|t�d�|j�dS(NRsselect 4+5 as foosrow is not instance of dict(	RRRtexecutetfetchoneRRtdictR(RRR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckIsProducedByFactoryGs
cCs|jj�dS(N(RR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyRPs(RRRR$R(((s*/sys/lib/python2.7/sqlite3/test/factory.pyR Cs			tRowFactoryTestscBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCstjd�|_dS(Ns:memory:(RRR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyRTscCsDd�|j_|jjd�j�}|jt|t�d�dS(NcSs
t|�S(N(tlist(RR((s*/sys/lib/python2.7/sqlite3/test/factory.pyt<lambda>Xssselect 1, 2srow is not instance of list(RRR!R"RRR&(RR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckCustomFactoryWs
cCs
tj|j_|jjd�j�}|jt|tj�d�|d|d}}|j|dkd�|j|dkd�|d|d	}}|j|dkd
�|j|dkd�|d|d}}|j|dkd
�|j|dkd�dS(Nsselect 1 as a, 2 as bs!row is not instance of sqlite.Rowtatbis$by name: wrong result for column 'a'itAtBs$by name: wrong result for column 'A's$by name: wrong result for column 'B'is#by index: wrong result for column 0s#by index: wrong result for column 1(RtRowRRR!R"RR(RRtcol1tcol2((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckSqliteRowIndex^s	cCs<tj|j_|jjd�j�}x|D]}q.WdS(s$Checks if the row object is iterablesselect 1 as a, 2 as bN(RR-RRR!R"(RRR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckSqliteRowIterqs
cCs7tj|j_|jjd�j�}t|�}dS(s4Checks if the row object can be converted to a tuplesselect 1 as a, 2 as bN(RR-RRR!R"ttuple(RRtt((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckSqliteRowAsTuplexscCsgtj|j_|jjd�j�}t|�}|j|d|d�|j|d|d�dS(sCChecks if the row object can be correctly converted to a dictionarysselect 1 as a, 2 as bR)R*N(RR-RRR!R"R#tassertEqual(RRR
((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckSqliteRowAsDict~s
cCs%tj|j_|jjd�j�}|jjd�j�}|jjd�j�}|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||�|jt	|�t	|��|j
||�|j
t	|�t	|��dS(s6Checks if the row object compares and hashes correctlysselect 1 as a, 2 as bsselect 1 as a, 3 as bN(RR-RRR!R"RtassertFalseR5thashtassertNotEqual(Rtrow_1trow_2trow_3((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckSqliteRowHashCmp�scCs|jj�dS(N(RR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyR�s(
RRRR(R0R1R4R6R=R(((s*/sys/lib/python2.7/sqlite3/test/factory.pyR%Ss							tTextFactoryTestscBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCstjd�|_dS(Ns:memory:(RRR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyR�scCsQtdd�}|jjd|f�j�}|jt|d�tkd�dS(Ns
�terreichtlatin1sselect ?istype of row[0] must be unicode(tunicodeRR!R"Rttype(RtaustriaR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckUnicode�scCs�t|j_tdd�}|jjd|f�j�}|jt|d�tkd�|j|d|jd�kd�dS(Ns
�terreichR?sselect ?istype of row[0] must be strsutf-8s(column must equal original data in UTF-8(	tstrRttext_factoryR@R!R"RRAtencode(RRBR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckString�s
 cCs�d�|j_tdd�}|jjd|jd�f�j�}|jt|d�tkd�|j|djd�d�dS(	NcSst|dd�S(Nsutf-8tignore(R@(tx((s*/sys/lib/python2.7/sqlite3/test/factory.pyR'�ss
�terreichR?sselect ?istype of row[0] must be unicodeureichs!column must contain original data(	RRER@R!RFR"RRAtendswith(RRBR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckCustom�s
' cCs�tj|j_tdd�}td�}|jjd|f�j�}|jjd|f�j�}|jt|d�tkd�|jt|d�t	kd�dS(Ns
�terreichR?t
Deutchlandsselect ?is%type of non-ASCII row must be unicodes"type of ASCII-only row must be str(
RtOptimizedUnicodeRRER@R!R"RRARD(RRBtgermanyta_rowtd_row((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckOptimizedUnicode�s cCs|jj�dS(N(RR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyR�s(RRRRCRGRKRQR(((s*/sys/lib/python2.7/sqlite3/test/factory.pyR>�s						t%TextFactoryTestsWithEmbeddedZeroBytescBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs9tjd�|_|jjd�|jjdd�dS(Ns:memory:screate table test (value text)s#insert into test (value) values (?)tab(RS(RRRR!(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyR�scCsJ|jjd�j�}|jt|d�t�|j|dd�dS(Nsselect value from testiRS(RR!R"tassertIsRAR@R5(RR((s*/sys/lib/python2.7/sqlite3/test/factory.pyRG�scCsYd�|j_|jjd�j�}|jt|d�t�|j|dd�dS(NcSs|S(N((RI((s*/sys/lib/python2.7/sqlite3/test/factory.pyR'�ssselect value from testiRS(RRER!R"RTRARDR5(RR((s*/sys/lib/python2.7/sqlite3/test/factory.pyRK�scCsYtj|j_|jjd�j�}|jt|d�t�|j	|dd�dS(Nsselect value from testiRS(
RRMRRER!R"RTRARDR5(RR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckOptimizedUnicodeAsString�scCs|tj|j_|jjd�|jjdd�|jjd�j�}|jt|d�t�|j	|dd�dS(Nsdelete from tests#insert into test (value) values (?)uäösselect value from testi(uäö(
RRMRRER!R"RTRAR@R5(RR((s*/sys/lib/python2.7/sqlite3/test/factory.pytCheckOptimizedUnicodeAsUnicode�scCs|jj�dS(N(RR(R((s*/sys/lib/python2.7/sqlite3/test/factory.pyR�s(RRRRGRKRURVR(((s*/sys/lib/python2.7/sqlite3/test/factory.pyRR�s						cCs�tjtd�}tjtd�}tjtd�}tjtd�}tjtd�}tjtd�}tj||||||f�S(NtCheck(	tunittestt	makeSuiteRRR R%R>RRt	TestSuite(tconnection_suitetcursor_suitetrow_suite_compatt	row_suitet
text_suitettext_zero_bytes_suite((s*/sys/lib/python2.7/sqlite3/test/factory.pytsuite�scCs tj�}|jt��dS(N(RXtTextTestRunnertrunRa(trunner((s*/sys/lib/python2.7/sqlite3/test/factory.pyttest�st__main__(RXtsqlite3RRRRRRtTestCaseRRR R%R>RRRaReR(((s*/sys/lib/python2.7/sqlite3/test/factory.pyt<module>s	
J#&			

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.