mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Fixed tests to run with antebellum Postgres versions
This commit is contained in:
parent
50b445fa12
commit
e4424bdfdc
|
@ -157,13 +157,16 @@ class CursorTests(unittest.TestCase):
|
|||
curs = self.conn.cursor(r'1-2-3 \ "test"')
|
||||
curs.execute("select data from invname order by data")
|
||||
self.assertEqual(curs.fetchall(), [(10,), (20,), (30,)])
|
||||
|
||||
|
||||
def test_withhold(self):
|
||||
self.assertRaises(psycopg2.ProgrammingError, self.conn.cursor,
|
||||
withhold=True)
|
||||
|
||||
self.assertRaises(psycopg2.ProgrammingError, self.conn.cursor,
|
||||
withhold=True)
|
||||
|
||||
curs = self.conn.cursor()
|
||||
curs.execute("drop table if exists withhold")
|
||||
try:
|
||||
curs.execute("drop table withhold")
|
||||
except psycopg2.ProgrammingError:
|
||||
self.conn.rollback()
|
||||
curs.execute("create table withhold (data int)")
|
||||
for i in (10, 20, 30):
|
||||
curs.execute("insert into withhold values (%s)", (i,))
|
||||
|
@ -183,11 +186,10 @@ class CursorTests(unittest.TestCase):
|
|||
curs.execute("select data from withhold order by data")
|
||||
self.conn.commit()
|
||||
self.assertEqual(curs.fetchall(), [(10,), (20,), (30,)])
|
||||
|
||||
|
||||
curs = self.conn.cursor()
|
||||
curs.execute("drop table withhold")
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
@skip_before_postgres(8, 2)
|
||||
def test_iter_named_cursor_efficient(self):
|
||||
|
|
|
@ -297,6 +297,13 @@ class TypesBasicTests(unittest.TestCase):
|
|||
self.assertEqual(1, l1)
|
||||
|
||||
def testGenericArray(self):
|
||||
a = self.execute("select '{1,2,3}'::int4[]")
|
||||
self.assertEqual(a, [1,2,3])
|
||||
a = self.execute("select array['a','b','''']::text[]")
|
||||
self.assertEqual(a, ['a','b',"'"])
|
||||
|
||||
@testutils.skip_before_postgres(8, 2)
|
||||
def testGenericArrayNull(self):
|
||||
def caster(s, cur):
|
||||
if s is None: return "nada"
|
||||
return int(s) * 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user