@@ -34,18 +34,8 @@ def test_cleanup_rows_unbuffered(self):
34
34
35
35
c2 = conn .cursor ()
36
36
37
- with warnings .catch_warnings (record = True ) as log :
38
- warnings .filterwarnings ("always" )
39
-
40
- c2 .execute ("select 1" )
41
-
42
- self .assertGreater (len (log ), 0 )
43
- self .assertEqual (
44
- "Previous unbuffered result was left incomplete" ,
45
- str (log [- 1 ].message ))
46
- self .assertEqual (
47
- c2 .fetchone (), (1 ,)
48
- )
37
+ c2 .execute ("select 1" )
38
+ self .assertEqual (c2 .fetchone (), (1 ,))
49
39
self .assertIsNone (c2 .fetchone ())
50
40
51
41
def test_cleanup_rows_buffered (self ):
@@ -91,14 +81,14 @@ def test_executemany(self):
91
81
92
82
# cursor._executed must bee "insert into test (data) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)"
93
83
# list args
94
- data = xrange (10 )
84
+ data = range (10 )
95
85
cursor .executemany ("insert into test (data) values (%s)" , data )
96
- self .assertTrue (cursor ._executed .endswith (",(7),(8),(9)" ), 'execute many with %s not in one query' )
86
+ self .assertTrue (cursor ._executed .endswith (b ",(7),(8),(9)" ), 'execute many with %s not in one query' )
97
87
98
88
# dict args
99
- data_dict = [{'data' : i } for i in xrange (10 )]
89
+ data_dict = [{'data' : i } for i in range (10 )]
100
90
cursor .executemany ("insert into test (data) values (%(data)s)" , data_dict )
101
- self .assertTrue (cursor ._executed .endswith (",(7),(8),(9)" ), 'execute many with %(data)s not in one query' )
91
+ self .assertTrue (cursor ._executed .endswith (b ",(7),(8),(9)" ), 'execute many with %(data)s not in one query' )
102
92
103
93
# %% in column set
104
94
cursor .execute ("""\
@@ -109,6 +99,6 @@ def test_executemany(self):
109
99
q = "INSERT INTO percent_test (`A%%`, `B%%`) VALUES (%s, %s)"
110
100
self .assertIsNotNone (pymysql .cursors .RE_INSERT_VALUES .match (q ))
111
101
cursor .executemany (q , [(3 , 4 ), (5 , 6 )])
112
- self .assertTrue (cursor ._executed .endswith ("(3, 4),(5, 6)" ), "executemany with %% not in one query" )
102
+ self .assertTrue (cursor ._executed .endswith (b "(3, 4),(5, 6)" ), "executemany with %% not in one query" )
113
103
finally :
114
104
cursor .execute ("DROP TABLE IF EXISTS percent_test" )
0 commit comments