Add test for #449

This commit is contained in:
INADA Naoki 2016-05-10 00:46:57 +09:00
parent 2ce27683fc
commit efd06ef265
1 changed files with 13 additions and 0 deletions

View File

@ -99,3 +99,16 @@ class CursorTest(base.PyMySQLTestCase):
data_dict = [{'data': i} for i in xrange(10)]
cursor.executemany("insert into test (data) values (%(data)s)", data_dict)
self.assertTrue(cursor._executed.endswith(",(7),(8),(9)"), 'execute many with %(data)s not in one query')
# %% in column set
cursor.execute("""\
CREATE TABLE percent_test (
`A%` INTEGER,
`B%` INTEGER)""")
try:
q = "INSERT INTO percent_test (`A%%`, `B%%`) VALUES (%s, %s)"
self.assertIsNotNone(pymysql.cursors.RE_INSERT_VALUES.match(q)
cursor.executemany(q, [(3, 4), (5, 6)])
self.assertTrue(cursor._executed.endswith("(3, 4),(5, 6)"), "executemany with %% not in one query")
finally:
cursor.execute("DROP TABLE IF EXISTS percent_test")