mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 21:00:33 +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):
|
def test_attributes(self):
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
try: cur.execute("select * from nonexist")
|
try:
|
||||||
except psycopg2.Error, e: pass
|
cur.execute("select * from nonexist")
|
||||||
|
except psycopg2.Error, exc:
|
||||||
|
e = exc
|
||||||
|
|
||||||
self.assertEqual(e.pgcode, '42P01')
|
self.assertEqual(e.pgcode, '42P01')
|
||||||
self.assert_(e.pgerror)
|
self.assert_(e.pgerror)
|
||||||
|
@ -150,8 +152,8 @@ class ExceptionsTestCase(unittest.TestCase):
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
try:
|
try:
|
||||||
cur.execute("select * from nonexist")
|
cur.execute("select * from nonexist")
|
||||||
except psycopg2.Error, e:
|
except psycopg2.Error, exc:
|
||||||
pass
|
e = exc
|
||||||
|
|
||||||
e1 = pickle.loads(pickle.dumps(e))
|
e1 = pickle.loads(pickle.dumps(e))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user