@step(u'[Mm]y "([^"]*)" answer is( NOT)? marked "([^"]*)"')
def assert_answer_mark(_step, problem_type, isnt_marked, correctness):
 assert (correctness in ['correct', 'incorrect', 'unanswered'])
 assert (problem_type in PROBLEM_DICT)
 for sel in PROBLEM_DICT[problem_type][correctness]:
  if bool(isnt_marked):
   world.wait_for((lambda _: world.is_css_not_present(sel)))
   has_expected = world.is_css_not_present(sel)
  else:
   world.css_find(sel)
   has_expected = world.is_css_present(sel)
  if has_expected:
   break
 assert has_expected

@ step ( u'[Mm]y "([^"]*)" answer is( NOT)? marked "([^"]*)"' ) def assert_answer_mark ( _step , problem_type , isnt_marked , correctness ) : assert ( correctness in [ 'correct' , 'incorrect' , 'unanswered' ] ) assert ( problem_type in PROBLEM_DICT ) for sel in PROBLEM_DICT [ problem_type ] [ correctness ] : if bool ( isnt_marked ) : world . wait_for ( ( lambda _ : world . is_css_not_present ( sel ) ) ) has_expected = world . is_css_not_present ( sel ) else : world . css_find ( sel ) has_expected = world . is_css_present ( sel ) if has_expected : break assert has_expected
assert that the expected answer mark is visible for a given problem type .