MCPcopy Create free account
hub / github.com/apache/arrow / TestRestorePyErrorBasics

Function TestRestorePyErrorBasics

python/pyarrow/src/arrow/python/python_test.cc:261–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261Status TestRestorePyErrorBasics() {
262 PyErr_SetString(PyExc_ZeroDivisionError, "zzzt");
263 auto st = ConvertPyError();
264 ASSERT_FALSE(PyErr_Occurred());
265 ASSERT_TRUE(st.IsUnknownError());
266 ASSERT_EQ(st.message(), "zzzt");
267 ASSERT_EQ(st.detail()->ToString(), FormatPythonException("ZeroDivisionError", "zzzt"));
268
269 RestorePyError(st);
270 ASSERT_TRUE(PyErr_Occurred());
271 PyObject* exc_type;
272 PyObject* exc_value;
273 PyObject* exc_traceback;
274 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
275 ASSERT_TRUE(PyErr_GivenExceptionMatches(exc_type, PyExc_ZeroDivisionError));
276 std::string py_message;
277 ASSERT_OK(internal::PyObject_StdStringStr(exc_value, &py_message));
278 ASSERT_EQ(py_message, "zzzt");
279
280 return Status::OK();
281}
282
283Status TestPyBufferInvalidInputObject() {
284 std::shared_ptr<Buffer> res;

Callers

nothing calls this directly

Calls 6

ConvertPyErrorFunction · 0.85
FormatPythonExceptionFunction · 0.85
RestorePyErrorFunction · 0.85
PyObject_StdStringStrFunction · 0.85
OKFunction · 0.50
ToStringMethod · 0.45

Tested by

no test coverage detected