Skip to content

Commit

Permalink
Update to ODPI-C 4.0.1 and add test to ensure that the offset is retu…
Browse files Browse the repository at this point in the history
…rned

correctly when a parse error is encountered.
  • Loading branch information
anthony-tuininga committed Jun 26, 2020
1 parent 8d719c3 commit 10e5c25
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Version 8.0 (June 2020)

#) Dropped support for Python 2. For those still requiring Python 2, see
:ref:`python2`.
#) Updated embedded ODPI-C to `version 4.0
#) Updated embedded ODPI-C to `version 4.0.1
<https://oracle.github.io/odpi/doc/releasenotes.html#
version-4-0-june-25-2020>`__.
version-4-0-1-june-26-2020>`__.
#) Reworked type management to clarify and simplify code

- Added :ref:`constants <dbtypes>` for all database types. The database
Expand Down
2 changes: 1 addition & 1 deletion odpi
14 changes: 9 additions & 5 deletions test/Error.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@

class TestCase(TestEnv.BaseTestCase):

def testParseError(self):
"test parse error returns offset correctly"
with self.assertRaises(cx_Oracle.Error) as cm:
self.cursor.execute("begin t_Missing := 5; end;")
errorObj, = cm.exception.args
self.assertEqual(errorObj.offset, 6)

def testPickleError(self):
"test picking/unpickling an error object"
errorObj = None
try:
with self.assertRaises(cx_Oracle.Error) as cm:
self.cursor.execute("""
begin
raise_application_error(-20101, 'Test!');
end;""")
except cx_Oracle.Error as e:
errorObj, = e.args
errorObj, = cm.exception.args
self.assertEqual(type(errorObj), cx_Oracle._Error)
self.assertTrue("Test!" in errorObj.message)
self.assertEqual(errorObj.code, 20101)
Expand All @@ -42,4 +47,3 @@ def testPickleError(self):

if __name__ == "__main__":
TestEnv.RunTestCases()

0 comments on commit 10e5c25

Please sign in to comment.