Ejemplo n.º 1
0
    def test_log(self):
        # quick & global config of logging system so output of loggers
        # goes to stdout
        logging.basicConfig(level=logging.DEBUG,
                            format="%(levelname)-8s <%(name)s> :: %(message)s")

        self.client = TimblClient(SERVER.port, log_tag="test_log_client")
        self.client.connect()

        instances = open(DATA_DIR + "/dimin.train").readlines()

        for inst in instances[:2]:
            self.client.classify(inst)

        self.client.query()

        self.client.set("+vdb +vdi +vn")

        for inst in instances[:2]:
            self.client.classify(inst)

        try:
            self.client.classify("x, x")
        except TimblClientError:
            pass

        try:
            self.client.set("-w 1")
        except TimblClientError:
            pass

        self.client.disconnect()

        # global reset of logging level
        logging.getLogger().setLevel(logging.CRITICAL)
Ejemplo n.º 2
0
    def setUp(self):
        if not SERVER:
            start_timbl_server()

        self.client = TimblClient(SERVER.port)
        self.client.connect()
Ejemplo n.º 3
0
 def _init_client(self):
     self._client = TimblClient(self._server.port)
     self._client.connect()