From efd06ef265037841625c5ab843ec75afb5bd8f74 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Tue, 10 May 2016 00:46:57 +0900 Subject: [PATCH] Add test for #449 --- pymysql/tests/test_cursor.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pymysql/tests/test_cursor.py b/pymysql/tests/test_cursor.py index 34bcaa6..fb0178b 100644 --- a/pymysql/tests/test_cursor.py +++ b/pymysql/tests/test_cursor.py @@ -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")