Connection' object has no attribute 'insert_id
(self)
| 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""" |