def assert_error_is_decorated(self, actual_msg, decorated_msg): """Asserts that decorate_beam_errors() raises with the right message. Args: actual_msg: str. The actual message raised originally. decorated_msg: str. The expected decorated message produced by the context manager. """ try: with job_test_utils.decorate_beam_errors(): raise beam_testing_util.BeamAssertException(actual_msg) except AssertionError as e: self.assertMultiLineEqual(python_utils.UNICODE(e), decorated_msg)
def test_does_not_decorate_message_with_non_beam_type(self): with self.assertRaisesRegexp(Exception, 'Error coming through!'): with job_test_utils.decorate_beam_errors(): raise Exception('Error coming through!')
def test_does_not_decorate_message_with_non_beam_type(self) -> None: with self.assertRaisesRegexp( Exception, 'Error coming through!'): # type: ignore[no-untyped-call] with job_test_utils.decorate_beam_errors(): raise Exception('Error coming through!')