def questions_list(): yield [ Question('A', { 'a': 0, 'b': 0.5, 'c': 0.5, 'd': 0 }), Question('B', { 'a': 1, 'b': 0, 'c': 0, 'd': 0 }), Question('C', { 'a': 0.33, 'b': 0.34, 'c': 0.33, 'd': 0 }), Question('D', { 'a': 0.5, 'b': 0, 'c': 0.5, 'd': 0 }), ]
def test_if_question_valid(name, options, is_valid): q = Question(name, options) assert q.validate_question() == is_valid
def test_adding_new_option_to_question(name, options, new_option_text, new_option_val): q = Question(name, options) q.add_option(new_option_text, new_option_val) assert new_option_text in str(q)
def questions_list(): yield [ Question('A', { 'a': 0, 'b': 0.5, 'c': 0.5, 'd': 0 }), Question('B', { 'a': 1, 'b': 0, 'c': 0, 'd': 0 }), Question('C', { 'a': 0.33, 'b': 0.34, 'c': 0.33, 'd': 0 }), Question('D', { 'a': 0.5, 'b': 0, 'c': 0.5, 'd': 0 }), Question('E', { 'a': 0, 'b': 0.4, 'c': 0.6, 'd': 0 }), Question('F', { 'a': 0, 'b': 0, 'c': 0, 'd': 1 }), Question('G', { 'a': 0.8, 'b': 0.2, 'c': 0, 'd': 0 }), Question('H', { 'a': 0, 'b': 0.33, 'c': 0.33, 'd': 0.34 }), Question('I', { 'a': 0, 'b': 0.5, 'c': 0.5, 'd': 0 }), Question('J', { 'a': 0, 'b': 0, 'c': 1, 'd': 0 }), Question('K', { 'a': 0, 'b': 0.5, 'c': 0, 'd': 0.5 }), ]