mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-10-31 15:57:31 +03:00 
			
		
		
		
	Fixed tests to run with antebellum Postgres versions
This commit is contained in:
		
							parent
							
								
									50b445fa12
								
							
						
					
					
						commit
						e4424bdfdc
					
				|  | @ -163,7 +163,10 @@ class CursorTests(unittest.TestCase): | ||||||
|                           withhold=True) |                           withhold=True) | ||||||
| 
 | 
 | ||||||
|         curs = self.conn.cursor() |         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)") |         curs.execute("create table withhold (data int)") | ||||||
|         for i in (10, 20, 30): |         for i in (10, 20, 30): | ||||||
|             curs.execute("insert into withhold values (%s)", (i,)) |             curs.execute("insert into withhold values (%s)", (i,)) | ||||||
|  | @ -188,7 +191,6 @@ class CursorTests(unittest.TestCase): | ||||||
|         curs.execute("drop table withhold") |         curs.execute("drop table withhold") | ||||||
|         self.conn.commit() |         self.conn.commit() | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     @skip_before_postgres(8, 2) |     @skip_before_postgres(8, 2) | ||||||
|     def test_iter_named_cursor_efficient(self): |     def test_iter_named_cursor_efficient(self): | ||||||
|         curs = self.conn.cursor('tmp') |         curs = self.conn.cursor('tmp') | ||||||
|  |  | ||||||
|  | @ -297,6 +297,13 @@ class TypesBasicTests(unittest.TestCase): | ||||||
|         self.assertEqual(1, l1) |         self.assertEqual(1, l1) | ||||||
| 
 | 
 | ||||||
|     def testGenericArray(self): |     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): |         def caster(s, cur): | ||||||
|             if s is None: return "nada" |             if s is None: return "nada" | ||||||
|             return int(s) * 2 |             return int(s) * 2 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user