Skip to content

Commit f324757

Browse files
Adjust formatting of PR #287.
1 parent a654bef commit f324757

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

src/cxoCursor.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,12 +1326,8 @@ static PyObject *cxoCursor_callProc(cxoCursor *cursor, PyObject *args,
13261326
keywordArguments) < 0)
13271327
return NULL;
13281328

1329-
// create the return value
1330-
numArgs = 0;
1331-
if (listOfArguments) {
1332-
//check already made in cxoCursor_call
1333-
numArgs = PySequence_Size(listOfArguments);
1334-
}
1329+
// create the return value (only positional arguments are returned)
1330+
numArgs = (listOfArguments) ? PySequence_Size(listOfArguments) : 0;
13351331
results = PyList_New(numArgs);
13361332
if (!results)
13371333
return NULL;

test/Cursor.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,35 +87,28 @@ def testCallProc(self):
8787
self.assertEqual(results, ["hi", 10, 2.0])
8888

8989
def testCallProcAllKeywords(self):
90-
"""test executing a stored procedure with arguments in keywordParameters"""
91-
kwargs = dict(
92-
a_InValue = "hi",
93-
a_InOutValue = self.cursor.var(cx_Oracle.NUMBER),
94-
a_OutValue = self.cursor.var(cx_Oracle.NUMBER),
95-
)
90+
"test executing a stored procedure with args in keywordParameters"
91+
kwargs = dict(a_InOutValue=self.cursor.var(cx_Oracle.NUMBER),
92+
a_InValue="hi", a_OutValue=self.cursor.var(cx_Oracle.NUMBER))
9693
kwargs['a_InOutValue'].setvalue(0, 5)
9794
results = self.cursor.callproc("proc_Test", keywordParameters=kwargs)
9895
self.assertEqual(results, [])
9996
self.assertEqual(kwargs['a_InOutValue'].getvalue(), 10)
10097
self.assertEqual(kwargs['a_OutValue'].getvalue(), 2.0)
10198

10299
def testCallProcOnlyLastKeyword(self):
103-
"""test executing a stored procedure with last argument in keywordParameters"""
104-
kwargs = dict(
105-
a_OutValue = self.cursor.var(cx_Oracle.NUMBER),
106-
)
107-
results = self.cursor.callproc("proc_Test", ("hi",5), kwargs)
100+
"test executing a stored procedure with last arg in keywordParameters"
101+
kwargs = dict(a_OutValue = self.cursor.var(cx_Oracle.NUMBER))
102+
results = self.cursor.callproc("proc_Test", ("hi", 5), kwargs)
108103
self.assertEqual(results, ["hi", 10])
109104
self.assertEqual(kwargs['a_OutValue'].getvalue(), 2.0)
110105

111106
def testCallProcRepeatedKeywordParameters(self):
112-
"""test executing a stored procedure with repeated argument in keywordParameters"""
113-
kwargs = dict(
114-
a_InValue = "hi",
115-
a_OutValue = self.cursor.var(cx_Oracle.NUMBER),
116-
)
107+
"test executing a stored procedure, repeated arg in keywordParameters"
108+
kwargs = dict(a_InValue="hi",
109+
a_OutValue=self.cursor.var(cx_Oracle.NUMBER))
117110
self.assertRaises(cx_Oracle.DatabaseError, self.cursor.callproc,
118-
"proc_Test", parameters=("hi",5), keywordParameters=kwargs)
111+
"proc_Test", parameters=("hi", 5), keywordParameters=kwargs)
119112

120113
def testCallProcNoArgs(self):
121114
"""test executing a stored procedure without any arguments"""

0 commit comments

Comments
 (0)