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

Method test_warnings

pymysql/tests/test_cursor.py:232–247  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

230 self.assertEqual(cur.fetchone(), (1,))
231
232 def test_warnings(self):
233 con = self.connect()
234 cur = con.cursor()
235 cur.execute("DROP TABLE IF EXISTS `no_exists_table`")
236 self.assertEqual(cur.warning_count, 1)
237
238 cur.execute("SHOW WARNINGS")
239 w = cur.fetchone()
240 self.assertEqual(w[1], ER.BAD_TABLE_ERROR)
241 self.assertIn(
242 "no_exists_table",
243 w[2],
244 )
245
246 cur.execute("SELECT 1")
247 self.assertEqual(cur.warning_count, 0)

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected