def METHOD_NAME(self, mock_method):
    ''' This tests a task with both YAML and k=v syntax
    - lineinfile: line=foo path=bar
        line: foo
    An accurate error message and position indicator are expected.
    _get_error_lines_from_file() returns (target_line, prev_line)
    '''
    self.obj.ansible_pos = ('foo.yml', 2, 1)
    mock_method.return_value = ['    line: foo\n', '- lineinfile: line=foo path=bar\n']
    e = AnsibleError(self.message, self.obj)
    self.assertEqual(
        e.message,
        ("This is the error message\n\nThe error appears to be in 'foo.yml': line 1, column 19, but may\nbe elsewhere in the "
         "file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n- lineinfile: line=foo path=bar\n"
         "                  ^ here\n\n"
         "There appears to be both 'k=v' shorthand syntax and YAML in this task. Only one syntax may be used.\n")
    )