Author: cito
Date: Fri Nov 20 10:13:42 2015
New Revision: 556
Log:
Use the modern except .. as syntax in the trunk
Modified:
trunk/module/TEST_PyGreSQL_classic_connection.py
trunk/module/TEST_PyGreSQL_classic_dbwrapper.py
Modified: trunk/module/TEST_PyGreSQL_classic_connection.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_connection.py Fri Nov 20 10:04:44
2015 (r555)
+++ trunk/module/TEST_PyGreSQL_classic_connection.py Fri Nov 20 10:13:42
2015 (r556)
@@ -53,7 +53,7 @@
def testCanConnect(self):
try:
connection = connect()
- except pg.Error, error:
+ except pg.Error as error:
self.fail('Cannot connect to database %s:\n%s' % (dbname, error))
try:
connection.close()
@@ -196,7 +196,7 @@
def sleep():
try:
self.connection.query('select pg_sleep(5)').getresult()
- except pg.ProgrammingError, error:
+ except pg.ProgrammingError as error:
errors.append(str(error))
thread = threading.Thread(target=sleep)
Modified: trunk/module/TEST_PyGreSQL_classic_dbwrapper.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_dbwrapper.py Fri Nov 20 10:04:44
2015 (r555)
+++ trunk/module/TEST_PyGreSQL_classic_dbwrapper.py Fri Nov 20 10:13:42
2015 (r556)
@@ -214,7 +214,7 @@
def testMethodQueryProgrammingError(self):
try:
self.db.query("select 1/0")
- except pg.ProgrammingError, error:
+ except pg.ProgrammingError as error:
self.assertEqual(error.sqlstate, '22012')
def testMethodEndcopy(self):
@@ -479,7 +479,7 @@
def testQueryProgrammingError(self):
try:
self.db.query("select 1/0")
- except pg.ProgrammingError, error:
+ except pg.ProgrammingError as error:
self.assertEqual(error.sqlstate, '22012')
def testPkey(self):
@@ -968,7 +968,7 @@
query("insert into test_table values (3)")
query("insert into test_table values (4)")
raise ValueError('test transaction should rollback')
- except ValueError, error:
+ except ValueError as error:
self.assertEqual(str(error), 'test transaction should rollback')
with self.db:
query("insert into test_table values (5)")
@@ -976,7 +976,7 @@
with self.db:
query("insert into test_table values (6)")
query("insert into test_table values (-1)")
- except pg.ProgrammingError, error:
+ except pg.ProgrammingError as error:
self.assertTrue('check' in str(error))
with self.db:
query("insert into test_table values (7)")
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql