本文整理匯總了Python中sqlite3.Warning方法的典型用法代碼示例。如果您正苦於以下問題:Python sqlite3.Warning方法的具體用法?Python sqlite3.Warning怎麽用?Python sqlite3.Warning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sqlite3
的用法示例。
在下文中一共展示了sqlite3.Warning方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: CheckWarning
# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import Warning [as 別名]
def CheckWarning(self):
self.assertTrue(issubclass(sqlite.Warning, StandardError),
"Warning is not a subclass of StandardError")
示例2: CheckExceptions
# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import Warning [as 別名]
def CheckExceptions(self):
# Optional DB-API extension.
self.assertEqual(self.cx.Warning, sqlite.Warning)
self.assertEqual(self.cx.Error, sqlite.Error)
self.assertEqual(self.cx.InterfaceError, sqlite.InterfaceError)
self.assertEqual(self.cx.DatabaseError, sqlite.DatabaseError)
self.assertEqual(self.cx.DataError, sqlite.DataError)
self.assertEqual(self.cx.OperationalError, sqlite.OperationalError)
self.assertEqual(self.cx.IntegrityError, sqlite.IntegrityError)
self.assertEqual(self.cx.InternalError, sqlite.InternalError)
self.assertEqual(self.cx.ProgrammingError, sqlite.ProgrammingError)
self.assertEqual(self.cx.NotSupportedError, sqlite.NotSupportedError)
示例3: CheckExecuteTooMuchSql
# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import Warning [as 別名]
def CheckExecuteTooMuchSql(self):
try:
self.cu.execute("select 5+4; select 4+5")
self.fail("should have raised a Warning")
except sqlite.Warning:
return
except:
self.fail("raised wrong exception")
示例4: CheckConnectionCall
# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import Warning [as 別名]
def CheckConnectionCall(self):
"""
Call a connection with a non-string SQL request: check error handling
of the statement constructor.
"""
self.assertRaises(sqlite.Warning, self.con, 1)
示例5: CheckWarning
# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import Warning [as 別名]
def CheckWarning(self):
self.assertTrue(issubclass(sqlite.Warning, Exception),
"Warning is not a subclass of Exception")
示例6: CheckExecuteTooMuchSql
# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import Warning [as 別名]
def CheckExecuteTooMuchSql(self):
with self.assertRaises(sqlite.Warning):
self.cu.execute("select 5+4; select 4+5")