Commit 40c7e9dc by pybind11_abseil authors Committed by Copybara-Service

Fix status_testing_no_cpp_eh_test

PiperOrigin-RevId: 670957824
parent baadf890
...@@ -56,7 +56,7 @@ PyObject* PyStatusNotOkOrNone() { ...@@ -56,7 +56,7 @@ PyObject* PyStatusNotOkOrNone() {
static PyObject* kImportedObj = nullptr; static PyObject* kImportedObj = nullptr;
if (kImportedObj == nullptr) { if (kImportedObj == nullptr) {
kImportedObj = py_base_utilities::ImportObjectOrReturnNone( kImportedObj = py_base_utilities::ImportObjectOrReturnNone(
"google3.third_party.pybind11_abseil.status", "StatusNotOk"); "pybind11_abseil.status", "StatusNotOk");
} }
return kImportedObj; return kImportedObj;
} }
......
...@@ -53,10 +53,10 @@ class StatusReturnTest(parameterized.TestCase): ...@@ -53,10 +53,10 @@ class StatusReturnTest(parameterized.TestCase):
expected = 'OK' expected = 'OK'
else: else:
expected = ( expected = (
'INVALID_ARGUMENT: Unable to cast Python instance of type <class' r"INVALID_ARGUMENT: Unable to cast Python instance of type <class"
" 'list'> to C++ type 'absl::Status'" r" 'list'> to C\+\+ type 'absl::(\w*::)?Status'"
) )
self.assertEqual(self.tm.CallCallbackWithStatusReturn(cb), expected) self.assertRegex(self.tm.CallCallbackWithStatusReturn(cb), expected)
def testAssertionErrorBare(self): # pylint: disable=invalid-name def testAssertionErrorBare(self): # pylint: disable=invalid-name
...@@ -117,10 +117,10 @@ class StatusOrReturnTest(parameterized.TestCase): ...@@ -117,10 +117,10 @@ class StatusOrReturnTest(parameterized.TestCase):
expected = 'INVALID_ARGUMENT: TypeError: expecting int' expected = 'INVALID_ARGUMENT: TypeError: expecting int'
else: else:
expected = ( expected = (
'INVALID_ARGUMENT: Unable to cast Python instance of type <class' r"INVALID_ARGUMENT: Unable to cast Python instance of type <class"
" 'str'> to C++ type 'absl::StatusOr<int>'" r" 'str'> to C\+\+ type 'absl::(\w*::)?StatusOr<int>'"
) )
self.assertEqual(self.tm.CallCallbackWithStatusOrIntReturn(cb), expected) self.assertRegex(self.tm.CallCallbackWithStatusOrIntReturn(cb), expected)
class StatusOrPyObjectPtrTest(absltest.TestCase): class StatusOrPyObjectPtrTest(absltest.TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment