def test_mode_invalid(question):
 with pytest.raises(TypeError):
  question.mode = 42

def test_mode_invalid ( question ) : with pytest . raises ( TypeError ) : question . mode = 42
test setting mode to something which is not a promptmode member .