def check_that_blanks_fail(problem):
 blank_answers = dict(((answer_id, u'') for answer_id in problem.get_question_answers()))
 grading_results = problem.grade_answers(blank_answers)
 try:
  assert all(((result == u'incorrect') for result in grading_results.values()))
 except AssertionError:
  log.error(u'Blank accepted as correct answer in {0} for {1}'.format(problem, [answer_id for (answer_id, result) in sorted(grading_results.items()) if (result != u'incorrect')]))

def check_that_blanks_fail ( problem ) : blank_answers = dict ( ( ( answer_id , u'' ) for answer_id in problem . get_question_answers ( ) ) ) grading_results = problem . grade_answers ( blank_answers ) try : assert all ( ( ( result == u'incorrect' ) for result in grading_results . values ( ) ) ) except AssertionError : log . error ( u'Blank accepted as correct answer in {0} for {1}' . format ( problem , [ answer_id for ( answer_id , result ) in sorted ( grading_results . items ( ) ) if ( result != u'incorrect' ) ] ) )
leaving it blank should never work .