Mercurial > p > mysql-python > mysqldb-2
comparison 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 |
parents | 34176b94a93f |
children | 5a7c30cd9de2 |
comparison
equal
deleted
inserted
replaced
64:2d6a35051f64 | 65:7a60c4574baf |
---|---|
79 try: | 79 try: |
80 self.cursor.execute("describe some_non_existent_table"); | 80 self.cursor.execute("describe some_non_existent_table"); |
81 except self.connection.ProgrammingError, msg: | 81 except self.connection.ProgrammingError, msg: |
82 self.failUnless(msg[0] == ER.NO_SUCH_TABLE) | 82 self.failUnless(msg[0] == ER.NO_SUCH_TABLE) |
83 | 83 |
84 def test_INSERT_VALUES(self): | |
85 from MySQLdb.cursors import INSERT_VALUES | |
86 query = """INSERT FOO (a, b, c) VALUES (%s, %s, %s)""" | |
87 matched = INSERT_VALUES.match(query) | |
88 self.failUnless(matched) | |
89 start = matched.group('start') | |
90 end = matched.group('end') | |
91 values = matched.group('values') | |
92 self.failUnless(start == """INSERT FOO (a, b, c) VALUES """) | |
93 self.failUnless(values == "(%s, %s, %s)") | |
94 self.failUnless(end == "") | |
95 | |
84 def test_ping(self): | 96 def test_ping(self): |
85 self.connection.ping() | 97 self.connection.ping() |
86 | 98 |
87 | 99 |
88 if __name__ == '__main__': | 100 if __name__ == '__main__': |