diff options
author | Guido van Rossum <guido@python.org> | 2007-01-10 16:19:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-01-10 16:19:56 (GMT) |
commit | b940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch) | |
tree | 0b9ea19eba1e665dac95126c3140ac2bc36326ad /Lib/sqlite3/test | |
parent | 893523e80a2003d4a630aafb84ba016e0070cbbd (diff) | |
download | cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2 |
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V"
(b) V is now limited to a simple name (local variable)
(c) V is now deleted at the end of the except block
Diffstat (limited to 'Lib/sqlite3/test')
-rw-r--r-- | Lib/sqlite3/test/dbapi.py | 2 | ||||
-rw-r--r-- | Lib/sqlite3/test/hooks.py | 8 | ||||
-rw-r--r-- | Lib/sqlite3/test/userfunctions.py | 16 |
3 files changed, 13 insertions, 13 deletions
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py index b08da9c..6fe93ab 100644 --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -326,7 +326,7 @@ class CursorTests(unittest.TestCase): self.fail("should have raised a TypeError") except TypeError: return - except Exception, e: + except Exception as e: print "raised", e.__class__ self.fail("raised wrong exception.") diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py index 761bdaa..d67028f 100644 --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -36,7 +36,7 @@ class CollationTests(unittest.TestCase): try: con.create_collation("X", 42) self.fail("should have raised a TypeError") - except TypeError, e: + except TypeError as e: self.failUnlessEqual(e.args[0], "parameter must be callable") def CheckCreateCollationNotAscii(self): @@ -44,7 +44,7 @@ class CollationTests(unittest.TestCase): try: con.create_collation("collä", cmp) self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError, e: + except sqlite.ProgrammingError as e: pass def CheckCollationIsUsed(self): @@ -73,7 +73,7 @@ class CollationTests(unittest.TestCase): try: result = con.execute(sql).fetchall() self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: + except sqlite.OperationalError as e: self.failUnlessEqual(e.args[0].lower(), "no such collation sequence: mycoll") def CheckCollationRegisterTwice(self): @@ -101,7 +101,7 @@ class CollationTests(unittest.TestCase): try: 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, e: + except sqlite.OperationalError as e: if not e.args[0].startswith("no such collation sequence"): self.fail("wrong OperationalError raised") diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py index e455fb6..a7cdcae 100644 --- a/Lib/sqlite3/test/userfunctions.py +++ b/Lib/sqlite3/test/userfunctions.py @@ -205,7 +205,7 @@ class FunctionTests(unittest.TestCase): cur.execute("select raiseexception()") cur.fetchone() self.fail("should have raised OperationalError") - except sqlite.OperationalError, e: + except sqlite.OperationalError as e: self.failUnlessEqual(e.args[0], 'user-defined function raised exception') def CheckParamString(self): @@ -279,7 +279,7 @@ class AggregateTests(unittest.TestCase): try: cur.execute("select nostep(t) from test") self.fail("should have raised an AttributeError") - except AttributeError, e: + except AttributeError as e: self.failUnlessEqual(e.args[0], "'AggrNoStep' object has no attribute 'step'") def CheckAggrNoFinalize(self): @@ -288,7 +288,7 @@ class AggregateTests(unittest.TestCase): cur.execute("select nofinalize(t) from test") val = cur.fetchone()[0] self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: + except sqlite.OperationalError as e: self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") def CheckAggrExceptionInInit(self): @@ -297,7 +297,7 @@ class AggregateTests(unittest.TestCase): cur.execute("select excInit(t) from test") val = cur.fetchone()[0] self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: + except sqlite.OperationalError as e: self.failUnlessEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") def CheckAggrExceptionInStep(self): @@ -306,7 +306,7 @@ class AggregateTests(unittest.TestCase): cur.execute("select excStep(t) from test") val = cur.fetchone()[0] self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: + except sqlite.OperationalError as e: self.failUnlessEqual(e.args[0], "user-defined aggregate's 'step' method raised error") def CheckAggrExceptionInFinalize(self): @@ -315,7 +315,7 @@ class AggregateTests(unittest.TestCase): cur.execute("select excFinalize(t) from test") val = cur.fetchone()[0] self.fail("should have raised an OperationalError") - except sqlite.OperationalError, e: + except sqlite.OperationalError as e: self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") def CheckAggrCheckParamStr(self): @@ -384,7 +384,7 @@ class AuthorizerTests(unittest.TestCase): def CheckTableAccess(self): try: self.con.execute("select * from t2") - except sqlite.DatabaseError, e: + except sqlite.DatabaseError as e: if not e.args[0].endswith("prohibited"): self.fail("wrong exception text: %s" % e.args[0]) return @@ -393,7 +393,7 @@ class AuthorizerTests(unittest.TestCase): def CheckColumnAccess(self): try: self.con.execute("select c2 from t1") - except sqlite.DatabaseError, e: + except sqlite.DatabaseError as e: if not e.args[0].endswith("prohibited"): self.fail("wrong exception text: %s" % e.args[0]) return |