Esempio n. 1
0
def test_describe_engine(tc):
    channel = gtp_engine_fixtures.get_test_channel()
    controller = Gtp_controller(channel, 'player test')
    short_s, long_s = gtp_controller.describe_engine(controller)
    tc.assertEqual(short_s, "unknown")
    tc.assertEqual(long_s, "unknown")

    channel = gtp_engine_fixtures.get_test_channel()
    channel.engine.add_command('name', lambda args:"test engine")
    controller = Gtp_controller(channel, 'player test')
    short_s, long_s = gtp_controller.describe_engine(controller)
    tc.assertEqual(short_s, "test engine")
    tc.assertEqual(long_s, "test engine")

    channel = gtp_engine_fixtures.get_test_channel()
    channel.engine.add_command('name', lambda args:"test engine")
    channel.engine.add_command('version', lambda args:"1.2.3")
    controller = Gtp_controller(channel, 'player test')
    short_s, long_s = gtp_controller.describe_engine(controller)
    tc.assertEqual(short_s, "test engine:1.2.3")
    tc.assertEqual(long_s, "test engine:1.2.3")

    channel = gtp_engine_fixtures.get_test_channel()
    channel.engine.add_command('name', lambda args:"test engine")
    channel.engine.add_command('version', lambda args:"1.2.3")
    channel.engine.add_command(
        'gomill-describe_engine',
        lambda args:"test engine (v1.2.3):\n  pl\xc3\xa1yer \xa3")
    controller = Gtp_controller(channel, 'player test')
    short_s, long_s = gtp_controller.describe_engine(controller)
    tc.assertEqual(short_s, "test engine:1.2.3")
    tc.assertEqual(long_s, "test engine (v1.2.3):\n  pl\xc3\xa1yer ?")

    channel = gtp_engine_fixtures.get_test_channel()
    channel.engine.add_command('name', lambda args:"test engine")
    channel.engine.add_command('version', lambda args:"test engine v1.2.3")
    controller = Gtp_controller(channel, 'player test')
    short_s, long_s = gtp_controller.describe_engine(controller)
    tc.assertEqual(short_s, "test engine:v1.2.3")
    tc.assertEqual(long_s, "test engine:v1.2.3")
Esempio n. 2
0
    def request_engine_descriptions(self):
        """Obtain the engines' name, version, and description by GTP.

        After you have called this, you can retrieve the results from the
        engine_names and engine_descriptions attributes.

        If this has been called, other methods will use the engine name and/or
        description when appropriate (ie, call this if you want proper engine
        names to appear in the SGF file).

        """
        for colour in "b", "w":
            controller = self.controllers[colour]
            player = self.players[colour]
            short_s, long_s = gtp_controller.describe_engine(controller, player)
            self.engine_names[player] = short_s
            self.engine_descriptions[player] = long_s
Esempio n. 3
0
    def request_engine_descriptions(self):
        """Obtain the engines' name, version, and description by GTP.

        After you have called this, you can retrieve the results from the
        engine_names and engine_descriptions attributes.

        If this has been called, other methods will use the engine name and/or
        description when appropriate (ie, call this if you want proper engine
        names to appear in the SGF file).

        """
        for colour in "b", "w":
            controller = self.controllers[colour]
            player = self.players[colour]
            short_s, long_s = gtp_controller.describe_engine(
                controller, player)
            self.engine_names[player] = short_s
            self.engine_descriptions[player] = long_s