def test_questioner_identifies_a_correct_answer_inside_a_message(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } s = Subject(Connection(), question, Questions_Asked(), Player_Scores(), Timer()) participant_answer = "I would say OMG Han! Chewie! They're all here! what do you think?" actual = s.check_answer(participant_answer) self.assertEqual(actual, True)
def test_questioner_identifies_a_correct_answer_ignoring_case(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } s = Subject(Connection(), question, Questions_Asked(), Player_Scores(), Timer()) participant_answer = "OmG hAn! CheWIe! theY're all hEre!" actual = s.check_answer(participant_answer) self.assertEqual(actual, True)
def test_questioner_identifies_an_incorrect_answer(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } s = Subject(Connection(), question, Questions_Asked(), Player_Scores(), Timer()) participant_answer = "I don't know, some kind of goblin-man." actual = s.check_answer(participant_answer) self.assertEqual(actual, False)
def test_questioner_identifies_a_correct_answer_ignoring_internal_whitespace(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } s = Subject(Connection(), question, Questions_Asked(), Player_Scores(), Timer()) participant_answer = " \t \rOMGHan! Chewie! \t They're all here!\r \n " actual = s.check_answer(participant_answer) self.assertEqual(actual, True)
def test_questioner_identifies_a_correct_answer_even_with_garbage_characters_interleaved(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } participant_answer = "O!M@G#H$a%n^?&C*(h)e_w-i+e=!{T}[h]e|y'r\\e:a;l\"l'<h>e,r.e/" s = Subject(Connection(), question, Questions_Asked(), Player_Scores(), Timer()) actual = s.check_answer(participant_answer) self.assertEqual(actual, True)