r54038 - python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/hooks.py python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/userfunctions.py

Author: brett.cannon Date: Wed Feb 28 22:10:02 2007 New Revision: 54038 Modified: python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/hooks.py python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/userfunctions.py Log: Fix sqlite3's tests for BaseException.args removal. Modified: python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/hooks.py ============================================================================== --- python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/hooks.py (original) +++ python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/hooks.py Wed Feb 28 22:10:02 2007 @@ -37,7 +37,7 @@ con.create_collation("X", 42) self.fail("should have raised a TypeError") except TypeError as e: - self.failUnlessEqual(e.args[0], "parameter must be callable") + self.failUnlessEqual(e.message, "parameter must be callable") def CheckCreateCollationNotAscii(self): con = sqlite.connect(":memory:") @@ -102,7 +102,7 @@ con.execute("select 'a' as x union select 'b' as x order by x collate mycoll") self.fail("should have raised an OperationalError") except sqlite.OperationalError as e: - if not e.args[0].startswith("no such collation sequence"): + if not e.message.startswith("no such collation sequence"): self.fail("wrong OperationalError raised") def suite(): Modified: python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/userfunctions.py ============================================================================== --- python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/userfunctions.py (original) +++ python/branches/p3yk_no_args_on_exc/Lib/sqlite3/test/userfunctions.py Wed Feb 28 22:10:02 2007 @@ -206,7 +206,8 @@ cur.fetchone() self.fail("should have raised OperationalError") except sqlite.OperationalError as e: - self.failUnlessEqual(e.args[0], 'user-defined function raised exception') + self.failUnlessEqual(e.message, + 'user-defined function raised exception') def CheckParamString(self): cur = self.con.cursor() @@ -280,7 +281,8 @@ cur.execute("select nostep(t) from test") self.fail("should have raised an AttributeError") except AttributeError as e: - self.failUnlessEqual(e.args[0], "'AggrNoStep' object has no attribute 'step'") + self.failUnlessEqual(e.message, + "'AggrNoStep' object has no attribute 'step'") def CheckAggrNoFinalize(self): cur = self.con.cursor() @@ -289,7 +291,8 @@ val = cur.fetchone()[0] self.fail("should have raised an OperationalError") except sqlite.OperationalError as e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.failUnlessEqual(e.message, + "user-defined aggregate's 'finalize' method raised error") def CheckAggrExceptionInInit(self): cur = self.con.cursor() @@ -298,7 +301,8 @@ val = cur.fetchone()[0] self.fail("should have raised an OperationalError") except sqlite.OperationalError as e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") + self.failUnlessEqual(e.message, + "user-defined aggregate's '__init__' method raised error") def CheckAggrExceptionInStep(self): cur = self.con.cursor() @@ -307,7 +311,8 @@ val = cur.fetchone()[0] self.fail("should have raised an OperationalError") except sqlite.OperationalError as e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's 'step' method raised error") + self.failUnlessEqual(e.message, + "user-defined aggregate's 'step' method raised error") def CheckAggrExceptionInFinalize(self): cur = self.con.cursor() @@ -316,7 +321,8 @@ val = cur.fetchone()[0] self.fail("should have raised an OperationalError") except sqlite.OperationalError as e: - self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.failUnlessEqual(e.message, + "user-defined aggregate's 'finalize' method raised error") def CheckAggrCheckParamStr(self): cur = self.con.cursor() @@ -385,7 +391,7 @@ try: self.con.execute("select * from t2") except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): + if not e.message.endswith("prohibited"): self.fail("wrong exception text: %s" % e.args[0]) return self.fail("should have raised an exception due to missing privileges") @@ -394,7 +400,7 @@ try: self.con.execute("select c2 from t1") except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): + if not e.message.endswith("prohibited"): self.fail("wrong exception text: %s" % e.args[0]) return self.fail("should have raised an exception due to missing privileges")
participants (1)
-
brett.cannon