@@ -30,8 +30,8 @@ def test_datatypes(self):
30
30
try :
31
31
# insert values
32
32
v = (True , - 3 , 123456789012 , 5.7 , "hello'\" world" , u"Espa\xc3 \xb1 ol" , "binary\x00 data" .encode (conn .charset ), datetime .date (1988 ,2 ,2 ), datetime .datetime (2014 , 5 , 15 , 7 , 45 , 57 ), datetime .timedelta (5 ,6 ), datetime .time (16 ,32 ), time .localtime ())
33
- c .execute ("insert 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)" , v )
34
- c .execute ("select b,i,l,f,s,u,bb,d,dt,td,t,st from test_datatypes" )
33
+ yield c .execute ("insert 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)" , v )
34
+ yield c .execute ("select b,i,l,f,s,u,bb,d,dt,td,t,st from test_datatypes" )
35
35
r = c .fetchone ()
36
36
self .assertEqual (util .int2byte (1 ), r [0 ])
37
37
self .assertEqual (v [1 :10 ], r [1 :10 ])
@@ -337,12 +337,13 @@ def test_bulk_insert_single_record(self):
337
337
yield cursor .execute ('commit' )
338
338
yield self ._verify_records (data )
339
339
340
+ @gen_test
340
341
def test_issue_288 (self ):
341
342
"""executemany should work with "insert ... on update" """
342
343
conn = self .connections [0 ]
343
344
cursor = conn .cursor ()
344
345
data = [(0 , "bob" , 21 , 123 ), (1 , "jim" , 56 , 45 ), (2 , "fred" , 100 , 180 )]
345
- cursor .executemany ("""insert
346
+ yield cursor .executemany ("""insert
346
347
into bulkinsert (id, name,
347
348
age, height)
348
349
values (%s,
@@ -361,17 +362,20 @@ def test_issue_288(self):
361
362
'fred' , 100,
362
363
180 ) on duplicate key update
363
364
age = values(age)""" ))
364
- cursor .execute ('commit' )
365
- self ._verify_records (data )
365
+ yield cursor .execute ('commit' )
366
+ yield self ._verify_records (data )
366
367
368
+ @gen_test
367
369
def test_warnings (self ):
368
370
con = self .connections [0 ]
369
371
cur = con .cursor ()
370
372
with warnings .catch_warnings (record = True ) as ws :
371
373
warnings .simplefilter ("always" )
372
- cur .execute ("drop table if exists no_exists_table" )
374
+ yield cur .execute ("drop table if exists no_exists_table" )
375
+ for w in ws :
376
+ print (w )
373
377
self .assertEqual (len (ws ), 1 )
374
- self .assertEqual (ws [0 ].category , pymysql .Warning )
378
+ self .assertEqual (ws [0 ].category , tornado_mysql .Warning )
375
379
self .assertTrue (u"no_exists_table" in str (ws [0 ].message ))
376
380
377
381
0 commit comments