def test_get_answer_parts(self): singleAnswer = "MyAnswer\n" self.assertEqual(["MyAnswer"], quizlet.get_answer_parts(singleAnswer)) multiAnswerStr = "* MyAnswer1\n* MyAnswer2" multiAnswerList = ["* MyAnswer1", "* MyAnswer2"] self.assertEqual(multiAnswerList, quizlet.get_answer_parts(multiAnswerStr))
def display_hint(answerParts): print("hint: " + quizlet.hintify(answerParts[0])) def see_answer_part(answerParts): print(answerParts[0]) print("You will have to repeat this question later!") ############################### # Begin the quiz! ############################### display_intro(opts) for questionNumber,term in enumerate(terms): answerParts = quizlet.get_answer_parts(term['definition']) print("Question %d/%d" % (questionNumber+1, len(terms))) while answerParts: display_term(term, answerParts) if(opts['hints']): display_hint(answerParts) userAnswer = raw_input('Your answer: ') print("") ################## # Command options ################## if userAnswer == "h": display_help()