Fixed exception testing on Python 3

...and so caught exceptions are local to the except suite in Py3.
(Lo sapevate? Sapevatelo!)
This commit is contained in:
Daniele Varrazzo 2012-02-23 23:15:42 +00:00
parent e57f3284eb
commit 98d6d96ee3

View File

@ -137,8 +137,10 @@ class ExceptionsTestCase(unittest.TestCase):
def test_attributes(self):
cur = self.conn.cursor()
try: cur.execute("select * from nonexist")
except psycopg2.Error, e: pass
try:
cur.execute("select * from nonexist")
except psycopg2.Error, exc:
e = exc
self.assertEqual(e.pgcode, '42P01')
self.assert_(e.pgerror)
@ -150,8 +152,8 @@ class ExceptionsTestCase(unittest.TestCase):
cur = self.conn.cursor()
try:
cur.execute("select * from nonexist")
except psycopg2.Error, e:
pass
except psycopg2.Error, exc:
e = exc
e1 = pickle.loads(pickle.dumps(e))