| 280 | |
| 281 | |
| 282 | class TestGitHubIssues(base.PyMySQLTestCase): |
| 283 | def test_issue_66(self): |
| 284 | """'Connection' object has no attribute 'insert_id'""" |
| 285 | conn = self.connect() |
| 286 | c = conn.cursor() |
| 287 | self.assertEqual(0, conn.insert_id()) |
| 288 | try: |
| 289 | with warnings.catch_warnings(): |
| 290 | warnings.filterwarnings("ignore") |
| 291 | c.execute("drop table if exists issue66") |
| 292 | c.execute( |
| 293 | "create table issue66 (id integer primary key auto_increment, x integer)" |
| 294 | ) |
| 295 | c.execute("insert into issue66 (x) values (1)") |
| 296 | c.execute("insert into issue66 (x) values (1)") |
| 297 | self.assertEqual(2, conn.insert_id()) |
| 298 | finally: |
| 299 | c.execute("drop table issue66") |
| 300 | |
| 301 | def test_issue_79(self): |
| 302 | """Duplicate field overwrites the previous one in the result of DictCursor""" |
| 303 | conn = self.connect() |
| 304 | c = conn.cursor(pymysql.cursors.DictCursor) |
| 305 | |
| 306 | with warnings.catch_warnings(): |
| 307 | warnings.filterwarnings("ignore") |
| 308 | c.execute("drop table if exists a") |
| 309 | c.execute("drop table if exists b") |
| 310 | c.execute("""CREATE TABLE a (id int, value int)""") |
| 311 | c.execute("""CREATE TABLE b (id int, value int)""") |
| 312 | |
| 313 | a = (1, 11) |
| 314 | b = (1, 22) |
| 315 | try: |
| 316 | c.execute("insert into a values (%s, %s)", a) |
| 317 | c.execute("insert into b values (%s, %s)", b) |
| 318 | |
| 319 | c.execute("SELECT * FROM a inner join b on a.id = b.id") |
| 320 | r = c.fetchall()[0] |
| 321 | self.assertEqual(r["id"], 1) |
| 322 | self.assertEqual(r["value"], 11) |
| 323 | self.assertEqual(r["b.value"], 22) |
| 324 | finally: |
| 325 | c.execute("drop table a") |
| 326 | c.execute("drop table b") |
| 327 | |
| 328 | def test_issue_95(self): |
| 329 | """Leftover trailing OK packet for "CALL my_sp" queries""" |
| 330 | conn = self.connect() |
| 331 | cur = conn.cursor() |
| 332 | with warnings.catch_warnings(): |
| 333 | warnings.filterwarnings("ignore") |
| 334 | cur.execute("DROP PROCEDURE IF EXISTS `foo`") |
| 335 | cur.execute( |
| 336 | """CREATE PROCEDURE `foo` () |
| 337 | BEGIN |
| 338 | SELECT 1; |
| 339 | END""" |
nothing calls this directly
no outgoing calls
no test coverage detected