コード例 #1
0
    def filepath2read(cls, filepath):
        logger = FoxylibLogger.func_level2logger(cls.filepath2read,
                                                 logging.DEBUG)
        logger.debug({"filepath": filepath})

        if not os.path.exists(filepath):
            return None

        bytes = FileTool.filepath2bytes(filepath)
        # logger.debug({"bytes":bytes})
        obj = pickle.loads(bytes)
        return obj
コード例 #2
0
    def test_03(self):
        logger = FoxylibLogger.func_level2logger(self.test_02, logging.DEBUG)
        cls = self.__class__

        filepath_hwp = os.path.join(FILE_DIR, "hwp샘플.hwp")
        bytes = FileTool.filepath2bytes(filepath_hwp)

        with NamedTemporaryFile() as f:
            f.write(bytes)
            hyp = HWPTool.filepath2text(f.name,)

        logger.debug({"hyp":hyp})
        self.assertEqual(hyp, cls.ref())