'Takes in an answer and a list of dictionaries mapping variables to values.
Each dictionary represents a test case for the answer.
Returns a tuple of formula evaluation results.'

def tupleize_answers(self, answer, var_dict_list):

    _ = self.capa_system.i18n.ugettext
    out = []
    for var_dict in var_dict_list:
        try:
            out.append(evaluator(var_dict, dict(), answer, case_sensitive=self.case_sensitive))
        except UndefinedVariable as err:
            log.debug('formularesponse:    undefined    variable    in    formula=%s', cgi.escape(answer))
            raise StudentInputError(_('Invalid    input:    {bad_input}    not    permitted    in    answer.').format(bad_input=err.message))
        except ValueError as err:
            if ('factorial' in err.message):
                log.debug('formularesponse:    factorial    function    used    in    response    that    tests    negative    and/or    non-integer    inputs.    Provided    answer    was:    %s', cgi.escape(answer))
                raise StudentInputError(_('Factorial    function    not    permitted    in    answer    for    this    problem.    Provided    answer    was:    {bad_input}').format(bad_input=cgi.escape(answer)))
            log.debug('formularesponse:    error    %s    in    formula', err)
            raise StudentInputError(_("Invalid    input:    Could    not    parse    '{bad_input}'    as    a    formula.").format(bad_input=cgi.escape(answer)))
        except Exception as err:
            log.debug('formularesponse:    error    %s    in    formula', err)
            raise StudentInputError(_("Invalid    input:    Could    not    parse    '{bad_input}'    as    a    formula").format(bad_input=cgi.escape(answer)))
    return out
