def test_ExceptionsAsConnectionAttributes(self):
# OPTIONAL EXTENSION
# Test for the optional DB API 2.0 extension, where the exceptions
# are exposed as attributes on the Connection object
# I figure this optional extension will be implemented by any
# driver author who is using this test suite, so it is enabled
# by default.
warnings.simplefilter("ignore")
con = self._connect()
drv = self.driver
self.assertEqual(con.Warning is drv.Warning, True)
self.assertEqual(con.Error is drv.Error, True)
self.assertEqual(con.InterfaceError is drv.InterfaceError, True)
self.assertEqual(con.DatabaseError is drv.DatabaseError, True)
self.assertEqual(con.OperationalError is drv.OperationalError, True)
self.assertEqual(con.IntegrityError is drv.IntegrityError, True)
self.assertEqual(con.InternalError is drv.InternalError, True)
self.assertEqual(con.ProgrammingError is drv.ProgrammingError, True)
self.assertEqual(con.NotSupportedError is drv.NotSupportedError, True)
warnings.resetwarnings()
con.close()
评论列表
文章目录