Codebase list python-cx-oracle / 10e5c25
Update to ODPI-C 4.0.1 and add test to ensure that the offset is returned correctly when a parse error is encountered. Anthony Tuininga 3 years ago
3 changed file(s) with 11 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
99
1010 #) Dropped support for Python 2. For those still requiring Python 2, see
1111 :ref:`python2`.
12 #) Updated embedded ODPI-C to `version 4.0
12 #) Updated embedded ODPI-C to `version 4.0.1
1313 <https://oracle.github.io/odpi/doc/releasenotes.html#
14 version-4-0-june-25-2020>`__.
14 version-4-0-1-june-26-2020>`__.
1515 #) Reworked type management to clarify and simplify code
1616
1717 - Added :ref:`constants <dbtypes>` for all database types. The database
(No changes)
1515
1616 class TestCase(TestEnv.BaseTestCase):
1717
18 def testParseError(self):
19 "test parse error returns offset correctly"
20 with self.assertRaises(cx_Oracle.Error) as cm:
21 self.cursor.execute("begin t_Missing := 5; end;")
22 errorObj, = cm.exception.args
23 self.assertEqual(errorObj.offset, 6)
24
1825 def testPickleError(self):
1926 "test picking/unpickling an error object"
20 errorObj = None
21 try:
27 with self.assertRaises(cx_Oracle.Error) as cm:
2228 self.cursor.execute("""
2329 begin
2430 raise_application_error(-20101, 'Test!');
2531 end;""")
26 except cx_Oracle.Error as e:
27 errorObj, = e.args
32 errorObj, = cm.exception.args
2833 self.assertEqual(type(errorObj), cx_Oracle._Error)
2934 self.assertTrue("Test!" in errorObj.message)
3035 self.assertEqual(errorObj.code, 20101)
4146
4247 if __name__ == "__main__":
4348 TestEnv.RunTestCases()
44