Skip to content

Commit b951f7f

Browse files
committed
test: Enable unicode tests in psycopg2
Signed-off-by: Ferenc Géczi <[email protected]>
1 parent dbd84c1 commit b951f7f

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

tests/clients/test_psycopg2.py

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -210,32 +210,27 @@ def test_error_capture(self):
210210
# Added to validate unicode support and register_type.
211211
def test_unicode(self):
212212
ext.register_type(ext.UNICODE, self.cursor)
213-
#
214-
# Python 2 chokes on Unicode and CircleCI tests are hanging (but pass locally).
215-
# Disable these tests for now as we want to really just test register_type
216-
# anyways
217-
#
218-
# snowman = "\u2603"
219-
#
220-
# self.cursor.execute("delete from users where id in (1,2,3)")
221-
#
222-
# # unicode in statement
223-
# psycopg2.extras.execute_batch(self.cursor,
224-
# "insert into users (id, name) values (%%s, %%s) -- %s" % snowman, [(1, 'x')])
225-
# self.cursor.execute("select id, name from users where id = 1")
226-
# self.assertEqual(self.cursor.fetchone(), (1, 'x'))
227-
#
228-
# # unicode in data
229-
# psycopg2.extras.execute_batch(self.cursor,
230-
# "insert into users (id, name) values (%s, %s)", [(2, snowman)])
231-
# self.cursor.execute("select id, name from users where id = 2")
232-
# self.assertEqual(self.cursor.fetchone(), (2, snowman))
233-
#
234-
# # unicode in both
235-
# psycopg2.extras.execute_batch(self.cursor,
236-
# "insert into users (id, name) values (%%s, %%s) -- %s" % snowman, [(3, snowman)])
237-
# self.cursor.execute("select id, name from users where id = 3")
238-
# self.assertEqual(self.cursor.fetchone(), (3, snowman))
213+
snowman = "\u2603"
214+
215+
self.cursor.execute("delete from users where id in (1,2,3)")
216+
217+
# unicode in statement
218+
psycopg2.extras.execute_batch(self.cursor,
219+
"insert into users (id, name) values (%%s, %%s) -- %s" % snowman, [(1, 'x')])
220+
self.cursor.execute("select id, name from users where id = 1")
221+
self.assertEqual(self.cursor.fetchone(), (1, 'x'))
222+
223+
# unicode in data
224+
psycopg2.extras.execute_batch(self.cursor,
225+
"insert into users (id, name) values (%s, %s)", [(2, snowman)])
226+
self.cursor.execute("select id, name from users where id = 2")
227+
self.assertEqual(self.cursor.fetchone(), (2, snowman))
228+
229+
# unicode in both
230+
psycopg2.extras.execute_batch(self.cursor,
231+
"insert into users (id, name) values (%%s, %%s) -- %s" % snowman, [(3, snowman)])
232+
self.cursor.execute("select id, name from users where id = 3")
233+
self.assertEqual(self.cursor.fetchone(), (3, snowman))
239234

240235
def test_register_type(self):
241236
import uuid

0 commit comments

Comments
 (0)