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
9 | 9 |
|
10 | 10 |
#) Dropped support for Python 2. For those still requiring Python 2, see
|
11 | 11 |
:ref:`python2`.
|
12 | |
#) Updated embedded ODPI-C to `version 4.0
|
|
12 |
#) Updated embedded ODPI-C to `version 4.0.1
|
13 | 13 |
<https://oracle.github.io/odpi/doc/releasenotes.html#
|
14 | |
version-4-0-june-25-2020>`__.
|
|
14 |
version-4-0-1-june-26-2020>`__.
|
15 | 15 |
#) Reworked type management to clarify and simplify code
|
16 | 16 |
|
17 | 17 |
- Added :ref:`constants <dbtypes>` for all database types. The database
|
15 | 15 |
|
16 | 16 |
class TestCase(TestEnv.BaseTestCase):
|
17 | 17 |
|
|
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 |
|
18 | 25 |
def testPickleError(self):
|
19 | 26 |
"test picking/unpickling an error object"
|
20 | |
errorObj = None
|
21 | |
try:
|
|
27 |
with self.assertRaises(cx_Oracle.Error) as cm:
|
22 | 28 |
self.cursor.execute("""
|
23 | 29 |
begin
|
24 | 30 |
raise_application_error(-20101, 'Test!');
|
25 | 31 |
end;""")
|
26 | |
except cx_Oracle.Error as e:
|
27 | |
errorObj, = e.args
|
|
32 |
errorObj, = cm.exception.args
|
28 | 33 |
self.assertEqual(type(errorObj), cx_Oracle._Error)
|
29 | 34 |
self.assertTrue("Test!" in errorObj.message)
|
30 | 35 |
self.assertEqual(errorObj.code, 20101)
|
|
41 | 46 |
|
42 | 47 |
if __name__ == "__main__":
|
43 | 48 |
TestEnv.RunTestCases()
|
44 | |
|