def _convert_to_cpp_expecting_success(tmppy_source):
    identifier_generator = create_identifier_generator()
    try:
        (module_ir2, module_ir1) = _convert_tmppy_source_to_ir(tmppy_source, identifier_generator)
        e = None
    except ast_to_ir3.CompilationError as e1:
        e = e1
    if e:
        pytest.fail(textwrap.dedent('                The conversion from TMPPy to C++ failed.\n                stderr was:\n                {error_message}\n                \n                TMPPy source:\n                {tmppy_source}\n                ').format(tmppy_source=add_line_numbers(tmppy_source), error_message=e.args[0]), pytrace=False)
    try:
        header = ir1_to_ir0.module_to_ir0(module_ir1, identifier_generator)
        header = optimize_ir0.optimize_header(header, identifier_generator, verbose=False)
        cpp_source = ir0_to_cpp.header_to_cpp(header, identifier_generator)
        cpp_source = utils.clang_format(cpp_source)
        return (module_ir2, module_ir1, cpp_source)
    except ast_to_ir3.CompilationError as e1:
        e = e1
    if e:
        pytest.fail(textwrap.dedent('                The conversion from TMPPy to C++ failed.\n                stderr was:\n                {error_message}\n                \n                TMPPy source:\n                {tmppy_source}\n                \n                TMPPy IR2:\n                {tmppy_ir2}\n                \n                TMPPy IR1:\n                {tmppy_ir1}\n                ').format(tmppy_source=add_line_numbers(tmppy_source), tmppy_ir2=str(module_ir2), tmppy_ir1=str(module_ir1), error_message=e.args[0]), pytrace=False)
def _convert_to_cpp_expecting_success(tmppy_source):
    identifier_generator = create_identifier_generator()
    try:
        (module_ir2, module_ir1) = _convert_tmppy_source_to_ir(tmppy_source, identifier_generator)
        e = None
    except ast_to_ir3.CompilationError as e1:
        e = e1
    if e:
        pytest.fail(textwrap.dedent('                The conversion from TMPPy to C++ failed.\n                stderr was:\n                {error_message}\n                \n                TMPPy source:\n                {tmppy_source}\n                ').format(tmppy_source=add_line_numbers(tmppy_source), error_message=e.args[0]), pytrace=False)
    try:
        header = ir1_to_ir0.module_to_ir0(module_ir1, identifier_generator)
        header = optimize_ir0.optimize_header(header, identifier_generator, verbose=False)
        cpp_source = ir0_to_cpp.header_to_cpp(header, identifier_generator)
        cpp_source = utils.clang_format(cpp_source)
        return (module_ir2, module_ir1, cpp_source)
    except ast_to_ir3.CompilationError as e1:
        e = e1
    if e:
        pytest.fail(textwrap.dedent('                The conversion from TMPPy to C++ failed.\n                stderr was:\n                {error_message}\n                \n                TMPPy source:\n                {tmppy_source}\n                \n                TMPPy IR2:\n                {tmppy_ir2}\n                \n                TMPPy IR1:\n                {tmppy_ir1}\n                ').format(tmppy_source=add_line_numbers(tmppy_source), tmppy_ir2=str(module_ir2), tmppy_ir1=str(module_ir1), error_message=e.args[0]), pytrace=False)