'Helper to allow testing all errors that rescoring might return.'

def _rescore_problem_error_helper(self, exception_class):

    module = CapaFactory.create(attempts=1, done=True)
    with patch('capa.capa_problem.LoncapaProblem.get_grade_from_current_answers') as mock_rescore:
        mock_rescore.side_effect = exception_class(u'test    error    \u03a9')
        with self.assertRaises(exception_class):
            module.rescore(only_if_higher=False)
    self.assertEqual(module.attempts, 1)
