diff tests/test_MySQLdb_capabilities.py @ 65:7a60c4574baf MySQLdb

figleaf revealed that the INSERT_VALUES regex never matched. Added a test for this, and fixed the regex (forgot to add group anchors)
author adustman
date Sun, 29 Mar 2009 00:52:14 +0000 (2009-03-29)
parents 34176b94a93f
children 5a7c30cd9de2
line wrap: on
line diff
--- a/tests/test_MySQLdb_capabilities.py	Sat Mar 28 13:37:58 2009 +0000
+++ b/tests/test_MySQLdb_capabilities.py	Sun Mar 29 00:52:14 2009 +0000
@@ -81,6 +81,18 @@
         except self.connection.ProgrammingError, msg:
             self.failUnless(msg[0] == ER.NO_SUCH_TABLE)
     
+    def test_INSERT_VALUES(self):
+        from MySQLdb.cursors import INSERT_VALUES
+        query = """INSERT FOO (a, b, c) VALUES (%s, %s, %s)"""
+        matched = INSERT_VALUES.match(query)
+        self.failUnless(matched)
+        start = matched.group('start')
+        end = matched.group('end')
+        values = matched.group('values')
+        self.failUnless(start == """INSERT FOO (a, b, c) VALUES """)
+        self.failUnless(values == "(%s, %s, %s)")
+        self.failUnless(end == "")
+        
     def test_ping(self):
         self.connection.ping()