MCPcopy
hub / github.com/PyMySQL/PyMySQL / test_select_db

Method test_select_db

pymysql/tests/test_connection.py:485–496  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

483 self.assertEqual(cur.fetchone()[0], 0)
484
485 def test_select_db(self):
486 con = self.connect()
487 current_db = self.databases[0]["database"]
488 other_db = self.databases[1]["database"]
489
490 cur = con.cursor()
491 cur.execute("SELECT database()")
492 self.assertEqual(cur.fetchone()[0], current_db)
493
494 con.select_db(other_db)
495 cur.execute("SELECT database()")
496 self.assertEqual(cur.fetchone()[0], other_db)
497
498 def test_connection_gone_away(self):
499 """

Callers

nothing calls this directly

Calls 5

cursorMethod · 0.80
executeMethod · 0.80
select_dbMethod · 0.80
connectMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected