def _helper_assert_about_apply_and_get_result(
    is_multiline,
    compile_method,
    sub_method
):
    """
    Helper method to assert about the correct results of calls to
    apply_and_get_result to ensure the correct methods are called.
    """
    pattern = 'pattern whoopty'
    repl = 'replacement whoopty'
    compiled_pattern = 'whoopty compiled'
    subbed_result = 'substituted'
    starting_string = 'the start'

    compile_method.return_value = compiled_pattern
    sub_method.return_value = subbed_result

    if is_multiline:
        sub = substitute.Substitution(pattern, repl, True)
    else:
        sub = substitute.Substitution(pattern, repl, False)
    actual = sub.apply_and_get_result(starting_string)

    if is_multiline:
        compile_method.assert_called_once_with(pattern, re.MULTILINE)
    else:
        compile_method.assert_called_once_with(pattern)

    sub_method.assert_called_once_with(
        compiled_pattern,
        repl,
        starting_string
    )
    assert actual == subbed_result

    Helper method to assert about the correct results of calls to
    apply_and_get_result to ensure the correct methods are called.
    
test/substitute_test.py