From 40c7e9dc185d0f3d296177cfb17bd36920299f36 Mon Sep 17 00:00:00 2001 From: pybind11_abseil authors Date: Wed, 4 Sep 2024 07:09:08 -0700 Subject: [PATCH] Fix status_testing_no_cpp_eh_test PiperOrigin-RevId: 670957824 --- pybind11_abseil/compat/status_from_py_exc.cc | 2 +- .../tests/status_testing_no_cpp_eh_test_lib.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pybind11_abseil/compat/status_from_py_exc.cc b/pybind11_abseil/compat/status_from_py_exc.cc index dc38ef1..2bc6bf9 100644 --- a/pybind11_abseil/compat/status_from_py_exc.cc +++ b/pybind11_abseil/compat/status_from_py_exc.cc @@ -56,7 +56,7 @@ PyObject* PyStatusNotOkOrNone() { static PyObject* kImportedObj = nullptr; if (kImportedObj == nullptr) { kImportedObj = py_base_utilities::ImportObjectOrReturnNone( - "google3.third_party.pybind11_abseil.status", "StatusNotOk"); + "pybind11_abseil.status", "StatusNotOk"); } return kImportedObj; } diff --git a/pybind11_abseil/tests/status_testing_no_cpp_eh_test_lib.py b/pybind11_abseil/tests/status_testing_no_cpp_eh_test_lib.py index af460f7..e1b0a2d 100644 --- a/pybind11_abseil/tests/status_testing_no_cpp_eh_test_lib.py +++ b/pybind11_abseil/tests/status_testing_no_cpp_eh_test_lib.py @@ -53,10 +53,10 @@ def cb(): expected = 'OK' else: expected = ( - 'INVALID_ARGUMENT: Unable to cast Python instance of type to C++ type 'absl::Status'" + r"INVALID_ARGUMENT: Unable to cast Python instance of type 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 @@ -117,10 +117,10 @@ def cb(): expected = 'INVALID_ARGUMENT: TypeError: expecting int' else: expected = ( - 'INVALID_ARGUMENT: Unable to cast Python instance of type to C++ type 'absl::StatusOr'" + r"INVALID_ARGUMENT: Unable to cast Python instance of type to C\+\+ type 'absl::(\w*::)?StatusOr'" ) - self.assertEqual(self.tm.CallCallbackWithStatusOrIntReturn(cb), expected) + self.assertRegex(self.tm.CallCallbackWithStatusOrIntReturn(cb), expected) class StatusOrPyObjectPtrTest(absltest.TestCase):