MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / test_issue_66

Method test_issue_66

pymysql/tests/test_issues.py:283–299  ·  view source on GitHub ↗

Connection' object has no attribute 'insert_id

(self)

Source from the content-addressed store, hash-verified

281
282class 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"""

Callers

nothing calls this directly

Calls 4

cursorMethod · 0.80
insert_idMethod · 0.80
executeMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected