AlenkaF commented on code in PR #14117:
URL: https://github.com/apache/arrow/pull/14117#discussion_r976504871
##########
python/pyarrow/src/python_test.cc:
##########
@@ -92,81 +131,115 @@ std::string FormatPythonException(const std::string&
exc_class_name) {
return ss.str();
}
-TEST(CheckPyError, TestStatus) {
+Status TestCheckPyErrorStatus() {
Status st;
-
- auto check_error = [](Status& st, const char* expected_message = "some
error",
- std::string expected_detail = "") {
- st = CheckPyError();
- ASSERT_EQ(st.message(), expected_message);
- ASSERT_FALSE(PyErr_Occurred());
- if (expected_detail.size() > 0) {
- auto detail = st.detail();
- ASSERT_NE(detail, nullptr);
- ASSERT_EQ(detail->ToString(), expected_detail);
- }
- };
+ std::string expected_detail = "";
+
+ // auto check_error = [](Status& st, const char* expected_message = "some
error",
+ // std::string expected_detail = "") {
+ // st = CheckPyError();
+ // ASSERT_EQ(st.message(), expected_message);
+ // ASSERT_FALSE_PY(PyErr_Occurred());
+ // if (expected_detail.size() > 0) {
+ // auto detail = st.detail();
+ // ASSERT_NE(detail, nullptr);
+ // ASSERT_EQ(detail->ToString(), expected_detail);
+ // }
+ // };
for (PyObject* exc_type : {PyExc_Exception, PyExc_SyntaxError}) {
PyErr_SetString(exc_type, "some error");
- check_error(st);
+ //check_error(st);
Review Comment:
Aha, that I tried but was missing `ASSERT_OK(check_error(st));`. Thank you
so much!!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]