Correct test suite when CHAR encoding is not capable of handling unicode data.

This commit is contained in:
Anthony Tuininga 2017-11-14 11:02:41 -07:00
parent 3dc1fc497e
commit 02c5f5eb5d
2 changed files with 6 additions and 1 deletions

View File

@ -188,9 +188,11 @@ class TestLobVar(BaseTestCase):
value = u"\u03b4\u4e2a"
cursor = connection.cursor()
cursor.execute("truncate table TestNCLOBs")
cursor.setinputsizes(val = cx_Oracle.NCHAR)
cursor.execute("insert into TestNCLOBs values (1, :val)", val = value)
cursor.execute("select NCLOBCol from TestNCLOBs")
nclob, = cursor.fetchone()
cursor.setinputsizes(val = cx_Oracle.NCHAR)
cursor.execute("update TestNCLOBs set NCLOBCol = :val",
val = nclob.read() + value)
cursor.execute("select NCLOBCol from TestNCLOBs")

View File

@ -39,6 +39,7 @@ class TestNCharVar(BaseTestCase):
def testBindUnicode(self):
"test binding in a unicode"
self.cursor.setinputsizes(value = cx_Oracle.NCHAR)
self.cursor.execute("""
select * from TestUnicodes
where UnicodeCol = :value""",
@ -58,11 +59,13 @@ class TestNCharVar(BaseTestCase):
def testBindUnicodeAfterNumber(self):
"test binding in a unicode after setting input sizes to a number"
unicodeVal = self.cursor.var(cx_Oracle.NCHAR)
unicodeVal.setvalue(0, u"Unicode \u3042 6")
self.cursor.setinputsizes(value = cx_Oracle.NUMBER)
self.cursor.execute("""
select * from TestUnicodes
where UnicodeCol = :value""",
value = u"Unicode \u3042 6")
value = unicodeVal)
self.assertEqual(self.cursor.fetchall(), [self.dataByKey[6]])
def testBindUnicodeArrayDirect(self):