1 Star 0 Fork 0

张一卓/chinese-poetry

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test_poetry.py 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
JackeyGao 提交于 2020-04-28 17:32 . test: add caocaoshiji
# -*- coding: utf-8 -*-
import os
import json
import sys
import traceback
import functools
def check_json(f, _dir):
if not f.endswith('.json'):
return True
filepath = os.path.join(_dir, f)
with open(filepath) as file:
try:
_ = json.loads(file.read())
sys.stdout.write(f"{filepath} 校验成功")
return True
except:
sys.stderr.write(traceback.format_exc())
assert False, f"{filepath} 校验失败"
def __check_path__(path):
"""校验 指定目录 中的 json 文件"""
[ check_json(f, path) for f in os.listdir(path) ]
test_shi = functools.partial(__check_path__, './json')
test_ci = functools.partial(__check_path__, './ci')
test_shijing = functools.partial(__check_path__, './shijing')
test_lunyu = functools.partial(__check_path__, './lunyu')
test_huajianji = functools.partial(__check_path__, u'./wudai/huajianji/')
test_nantang2 = functools.partial(__check_path__, u'./wudai/nantang/')
test_youmengying = functools.partial(__check_path__, u'./youmengying/')
test_sishuwujing = functools.partial(__check_path__, u'./sishuwujing/')
test_yuanqu = functools.partial(__check_path__, u'./yuanqu/')
test_mengxue = functools.partial(__check_path__, u'./mengxue')
caocaoshiji = functools.partial(__check_path__, u'./caocaoshiji')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/zyz261017/chinese-poetry.git
git@gitee.com:zyz261017/chinese-poetry.git
zyz261017
chinese-poetry
chinese-poetry
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385