dbapi20.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:time2go 作者: twitchyliquid64 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号