def test_formula_range(cards_table): """ Expect a formula card to require a range. """ card, errors = FormulaCard.insert({ 'unit_id': 'RUF531', 'name': 'What is?', 'body': 'Testing 1234', 'options': [{ 'value': 'x', 'correct': True, 'feedback': 'Bazaaa...' }], 'variables': [{ 'name': 'x' }], 'default_incorrect_feedback': 'Boo!', }) assert len(errors) == 0 card, errors = card.update({'range': 0.1}) assert len(errors) == 0
def test_formula_default_feedback(db_conn, cards_table): """ Expect a formula card to require default feedback. """ card, errors = FormulaCard.insert(db_conn, { 'unit_id': 'RUF531', 'name': 'What is?', 'body': 'Testing 1234', 'options': [{ 'value': 'x', 'correct': True, 'feedback': 'Bazaaa...' }], 'variables': [{'name': 'x'}], }) assert len(errors) == 1 card, errors = card.update(db_conn, {'default_incorrect_feedback': 'Boo!'}) assert len(errors) == 0
def test_formula_range(cards_table): """ Expect a formula card to require a range. """ card, errors = FormulaCard.insert({ 'unit_id': 'RUF531', 'name': 'What is?', 'body': 'Testing 1234', 'options': [{ 'value': 'x', 'correct': True, 'feedback': 'Bazaaa...' }], 'variables': [{'name': 'x'}], 'default_incorrect_feedback': 'Boo!', }) assert len(errors) == 0 card, errors = card.update({'range': 0.1}) assert len(errors) == 0