Пример #1
0
    def test_quiz_with_string_answers(self):

        right_answer = 'Madison'
        user_answer = 'Madison'

        result = quiz.is_correct_answer(right_answer, user_answer)
        self.assertTrue(result)
    def test_quiz_with_string_answers(self):
        # for example, the question might be 'what is the capital of wisconsin'
        right_answer = 'Madison'
        user_answer = 'Madison'

        result = quiz.is_correct_answer(right_answer, user_answer)
        self.assertTrue(result)
 def test_quiz_answer_has_spaces(self):
     possible_user_answers = {
         'Madison': ' Madison',
         'Madison': 'Madison ',
         'Madison': '  Madison '
     }
     for right_answer, user_answer in possible_user_answers.items():
         result = quiz.is_correct_answer(right_answer, user_answer)
         self.assertTrue(result)
Пример #4
0
 def test_quiz_numeric_and_string_answer_right(self):
     right_answer = 100
     user_answer = '100'
     result = quiz.is_correct_answer(right_answer, user_answer)
     self.assertTrue(result)
Пример #5
0
 def test_quiz_numeric_answer_wrong_answer(self):
     right_answer = 200
     user_answer = 150
     result = quiz.is_correct_answer(right_answer, user_answer)
     self.assertFalse(result)
Пример #6
0
    def test_quiz_numeric_answers(self):
        right_answer = 42
        user_answer = 42

        result = quiz.is_correct_answer(right_answer, user_answer)
        self.assertTrue(result)
Пример #7
0
    def test_quiz_reports_wrong_answer(self):
        right_answer = 'Madison'
        user_answer = "Saint Paul"

        result = quiz.is_correct_answer(right_answer, user_answer)
        self.assertFalse(result)
Пример #8
0
    def test_quiz_different_cases(self):
        right_answer = 'Madison'
        uswer_answer = 'MADISON'

        result = quiz.is_correct_answer(right_answer, uswer_answer)
        self.assertTrue(result)
 def test_quiz_numeric_answers_incorrect(self):
     right_answer = 42
     user_answer = 120020
     result = quiz.is_correct_answer(right_answer, user_answer)
     self.assertFalse(result)
 def test_quiz_different_cases(self):
     right_answer = 'Madison'  # for example, q is capital of wisconsin
     user_answer = 'MADISON'  # this should be correct
     result = quiz.is_correct_answer(right_answer, user_answer)
     self.assertTrue(result)