コード例 #1
0
 def test_responder_hands_what_it_got_from_receive_to_handler(self):
     self.transmitter.receive = mock.MagicMock(return_value="for the handler")
     handler = ResponseHandler(MoveGenerator())
     handler.response = mock.Mock()
     responder = Responder(self.transmitter,handler)
     responder.respond()
     handler.response.assert_called_with("for the handler")
コード例 #2
0
 def test_responder_hands_what_it_got_from_receive_to_handler(self):
     self.transmitter.receive = mock.MagicMock(
         return_value="for the handler")
     handler = ResponseHandler(MoveGenerator())
     handler.response = mock.Mock()
     responder = Responder(self.transmitter, handler)
     responder.respond()
     handler.response.assert_called_with("for the handler")
コード例 #3
0
 def test_handler_defaults_difficulty_if_depth_not_set(self):
     data = {"board": {1:"x",2:"x",5:"o"}}
     handler = ResponseHandler(MoveGenerator())
     response = handler.response(data)
     self.assertEqual(3,response["ai_move"])
コード例 #4
0
 def test_responder_sends_what_it_got_from_handler(self):
     handler = ResponseHandler(mock.Mock())
     handler.response = mock.MagicMock(return_value="some stuff")
     responder = Responder(self.transmitter, handler)
     responder.respond()
     self.transmitter.send.assert_called_with("some stuff")
コード例 #5
0
 def test_responder_sends_what_it_got_from_handler(self):
     handler = ResponseHandler(mock.Mock())
     handler.response = mock.MagicMock(return_value="some stuff")
     responder = Responder(self.transmitter, handler)
     responder.respond()
     self.transmitter.send.assert_called_with("some stuff")