HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3/dist-packages/pymysql/tests/__pycache__/test_basic.cpython-35.pyc


Xe8@sddlZddlZddlZddlZddlmZddlmZddlZddl	m
Z
ddlmZdddgZ
Gd	dde
jZGd
dde
jZGddde
jZdS)N)SkipTest)util)base)ProgrammingErrorTestConversion
TestCursorTestBulkInsertsc@speZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
dS)rcCsh|jd}|j}|jdz-dd"ddddd	j|jtjd
ddtjdd
ddddtjd
dtjddtj	f}|jd||jd|j
}|jtj
d|d|j|dd|dd|jtjdd|djd|dj|d|jtj|d#dd|d$|jd|jddgd|jd|j
}|jtdgd||jdxuttttfD]a}|jd|ddg}|jd|f|j}|jd'||jdqWWd|jd!XdS)(z test every data type rzcreate table test_datatypes (b bit, i int, l bigint, f real, s varchar(32), u varchar(32), bb blob, d date, dt datetime, ts timestamp, td time, t time, st datetime)Tl2}rg@z
hello'" worldu
Españolzbinarydataii-9 zeinsert into test_datatypes (b,i,l,f,s,u,bb,d,dt,td,t,st) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)z6select b,i,l,f,s,u,bb,d,dt,td,t,st from test_datatypes
<Nzdelete from test_datatypesz>insert into test_datatypes (i, l) values (2,4), (6,8), (10,12)z5select l from test_datatypes where i in %s order by izdrop table test_datatypesrrr)rr)connectionscursorexecuteencodecharsetdatetimeZdate	timedeltatimeZ	localtimefetchoneassertEqualrZint2byteZhourZminutetuplelistset	frozensetfetchall)selfconncvrZseq_typeseqr2:/usr/lib/python3/dist-packages/pymysql/tests/test_basic.pytest_datatypess4

{
$:+



zTestConversion.test_datatypescCs|jd}|j}|jdzI|jddddddd	i|jd
|jd
|jWd|jdXdS)z test dict escaping rz8create table test_dict (a integer, b integer, c integer)z:insert into test_dict (a,b,c) values (%(a)s, %(b)s, %(c)s)arbr
r.r	zselect a,b,c from test_dictNzdrop table test_dict)rr
r	)rrrr&r%)r,r-r.r2r2r3	test_dict:s

"
zTestConversion.test_dictcCs{|jd}|j}|jdd}z:|jd||jd|j|f|jWd|jdXdS)Nrzcreate table test_dict (a text)zI am a test stringz%insert into test_dict (a) values (%s)zselect a from test_dictzdrop table test_dict)rrrr&r%)r,r-r.
test_valuer2r2r3test_stringFs


zTestConversion.test_stringcCs{|jd}|j}|jdd}z:|jd||jd|j|f|jWd|jdXdS)Nrz"create table test_dict (a integer)i90z%insert into test_dict (a) values (%s)zselect a from test_dictzdrop table test_dict)rrrr&r%)r,r-r.r8r2r2r3test_integerRs


zTestConversion.test_integercCstttdd}|jd}|j|dd|jA}|jd|f|jd|j||jdWdQRXdS)	ztest binary datarr	test_blobzcreate table test_blob (b blob)z%insert into test_blob (b) values (%s)zselect b from test_blobN)	bytes	bytearrayrangersafe_create_tablerrr&r%)r,datar-r.r2r2r3r<^s


zTestConversion.test_blobcCsc|jd}|j}|jd|jd|j|jd|jd|jdS)z' test conversion of null, empty string rzselect null,''Nzselect '',null)NrB)rBN)rrrr&r%)r,r-r.r2r2r3test_untypedjs


zTestConversion.test_untypedc
Cs|jd}|j}|jd|jtjddtjddtjdddtjddtjddtjdddtjddf|jdS)z test timedelta conversion rzselect time('12:30'), time('23:12:59'), time('23:12:59.05100'), time('-12:30'), time('-23:12:59'), time('-23:12:59.05100'), time('-00:30')iȯi{Fi8iN)rrrr&r"r#r%)r,r-r.r2r2r3test_timedeltass

zTestConversion.test_timedeltacCs|jd}|j|ds+td|j}tjdddd	d	d	d
}|jdz@|jdd
|f|jd|j|f|jWd|jdXdS)z( test datetime conversion w microsecondsrrrrz,target backend does not support microsecondsir	i:z3create table test_datetime (id int, ts datetime(6))z)insert into test_datetime values (%s, %s)rzselect ts from test_datetimeNzdrop table test_datetime)rrr)rmysql_server_isrrr"rr&r%)r,r-r.Zdtr2r2r3test_datetime_microsecondss
!


z)TestConversion.test_datetime_microsecondsN)__name__
__module____qualname__r4r7r9r:r<rCrDrHr2r2r2r3rs'	c@s@eZdZddZddZddZddZd	S)
rcCsn|jd}|j}|jdz3d}|jd|f|jd|jWd|jdXdS)z  test a fetchone() with no rows rz$create table test_nr (b varchar(32))pymysqlz#insert into test_nr (b) values (%s)Nzdrop table test_nr)rrrr&r%)r,r-r.rAr2r2r3test_fetch_no_results

zTestCursor.test_fetch_no_resultcCs|jd}|j}zy|jdx*tddD]}|jd|fq9W|jd|j\}|jttdd|Wd|jdXdS)z test aggregate functions rz(create table test_aggregates (i integer)rz+insert into test_aggregates (i) values (%s)z"select sum(i) from test_aggregatesNzdrop table test_aggregates)rrrr?r%r&sum)r,r-r.ir0r2r2r3test_aggregatess


#zTestCursor.test_aggregatescCs|jd}|j}|j|dd|jd|jd|jdd
|jdgt|j|jdS)z test a single tuple rZmystuffz-create table mystuff (id integer primary key)z#insert into mystuff (id) values (1)z#insert into mystuff (id) values (2)z%select id from mystuff where id in %srNr)rQ)r)rrr@rr&r(r+close)r,r-r.r2r2r3test_single_tuples


zTestCursor.test_single_tuplecCs
|jdj}d|d<tj|}|j|d
sJtd|j|dd|j}d	}|jd
|f|jd|j	d}|j
tj|tj||jd|f|j	d}|j
tj|tj|dS)NrZutf8mb4r!rr
z*JSON type is not supported on MySQL <= 5.6	test_jsonz]create table test_json (
    id int not null,
    json JSON not null,
    primary key (id)
);u{"hello": "こんにちは"}z2INSERT INTO test_json (id, `json`) values (42, %s)z,SELECT `json` from `test_json` WHERE `id`=42zSELECT CAST(%s AS JSON) AS x)rr
r)
Z	databasescopyrLZconnectrGrr@rrr%r&jsonloads)r,argsr-curZjson_strresr2r2r3rTs 

"zTestCursor.test_jsonN)rIrJrKrMrPrSrTr2r2r2r3rs6
csveZdZejjZfddZddZddZ	ddZ
d	d
ZddZd
dZ
S)rcsPtt|j|jd|_}|j|j}|j|dddS)NrZ
bulkinsertz]CREATE TABLE bulkinsert
(
id int(11),
name char(20),
age int,
height int,
PRIMARY KEY (id)
)
)superrsetUprr-rcursor_typer@)r,r-r.)	__class__r2r3r\s
	zTestBulkInserts.setUpcCsR|jd}|j}|jd|j}|jt|t|dS)Nrz,SELECT id, name, age, height from bulkinsert)rrrr+r&sorted)r,rAr-rresultr2r2r3_verify_records!s


zTestBulkInserts._verify_recordscCso|jd}|j}dddg}|jd
||j|jtd|jd|j|dS)Nrbob{rjim8rr
freddzCinsert into bulkinsert (id, name, age, height) values (%s,%s,%s,%s)siinsert into bulkinsert (id, name, age, height) values (0,'bob',21,123),(1,'jim',56,45),(2,'fred',100,180)commit)rrbrcrd)rrerfr)r
rgrhri)rrexecutemanyr&_last_executedr>rra)r,r-rrAr2r2r3test_bulk_insert(s
		

z TestBulkInserts.test_bulk_insertcCsu|jd}|j}dddg}|jd
||j|jjtd|jd|j|dS)Nrrbrcrdrrerfrr
rgrhrizJinsert
into bulkinsert (id, name,
age, height)
values (%s,
%s , %s,
%s )
 sxinsert
into bulkinsert (id, name,
age, height)
values (0,
'bob' , 21,
123 ),(1,
'jim' , 56,
45 ),(2,
'fred' , 100,
180 )rj)rrbrcrd)rrerfr)r
rgrhri)	rrrkr&rlstripr>rra)r,r-rrAr2r2r3$test_bulk_insert_multiline_statement6s

	

z4TestBulkInserts.test_bulk_insert_multiline_statementcCsP|jd}|j}dg}|jd||jd|j|dS)NrrbrcrdzCinsert into bulkinsert (id, name, age, height) values (%s,%s,%s,%s)rj)rrbrcrd)rrrkrra)r,r-rrAr2r2r3test_bulk_insert_single_recordNs
		
z.TestBulkInserts.test_bulk_insert_single_recordcCsu|jd}|j}dddg}|jd
||j|jjtd|jd|j|dS)z4executemany should work with "insert ... on update" rrbrcrdrrerfrr
rgrhriztinsert
into bulkinsert (id, name,
age, height)
values (%s,
%s , %s,
%s ) on duplicate key update
age = values(age)
 sinsert
into bulkinsert (id, name,
age, height)
values (0,
'bob' , 21,
123 ),(1,
'jim' , 56,
45 ),(2,
'fred' , 100,
180 ) on duplicate key update
age = values(age)rjN)rrbrcrd)rrerfr)r
rgrhri)	rrrkr&rlrnr>rra)r,r-rrAr2r2r3test_issue_288Ws




zTestBulkInserts.test_issue_288cCs|jd}|j}tjdd!}tjd|jdWdQRX|jt|d|j|djt	j
dt|djkr|j
dt|djfdS)	NrrecordTalwaysz$drop table if exists no_exists_tablerZno_exists_tablez'no_exists_table' not in %s)rrwarningscatch_warningssimplefilterrr&lencategoryrLWarningstrmessageZfail)r,ZconrYZwsr2r2r3
test_warningsrs

zTestBulkInserts.test_warnings)rIrJrKrLZcursorsZ
DictCursorr]r\rarmrorprqr|r2r2)r^r3rs	)r"rVr$rtZ	unittest2rrLrZpymysql.cursorsZ
pymysql.testsrZpymysql.errr__all__ZPyMySQLTestCaserrrr2r2r2r3<module>sw