mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
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:
parent
e57f3284eb
commit
98d6d96ee3
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user