コード例 #1
0
 def test_questioner_first_hint_returns_2_out_of_3_chars_in_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())
     actual = s.first_hint()
     self.assertEqual(actual, "O__ __n__C__w__!__h__'__ __l__e__!")
コード例 #2
0
 def test_questioner_has_a_strict_oder_to_its_message_flow(self):
     question = {
         'Ask': "What also floats in water?",
         'Answer': "A Duck!"
     }
     mock_connection = Connection()
     mock_timer = Timer()
     s = Subject(mock_connection, question, Questions_Asked(), Player_Scores(), Timer())
     s.go()
     self.assertEqual(len(mock_connection._message_list), 4)
     self.assertEqual(s.ask, mock_connection._message_list[0])
     self.assertEqual(s.first_hint(), mock_connection._message_list[1])
     self.assertEqual(s.second_hint(), mock_connection._message_list[2])
     self.assertTrue(mock_connection._message_list[3] in Chat.unanswered_questions)