本次提交主要包含以下内容: 1. 归档tests/hrbp目录下的旧版测试文件至tests/_app_蓝图版归档目录 2. 新增tests/_app_蓝图版归档/hrbp目录下的新版测试辅助脚本和测试用例 3. 新增雇主险场景下的WPS COM可行性验证脚本 4. 更新README.md中关于tests目录的说明,明确各子目录用途 5. 更新XQ0035工作流相关文件中的操作人UnionID,更换为人资专用号 6. 修复试用期变更脚本中日期转换的问题,确保AI表格时间戳正确转换为日期格式 7. 归档XQ0035工作流下的旧版测试脚本至测试归档目录
43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""
|
||
OCR 附件检测测试入口。
|
||
通用图像识别见 app/utils/ocr.py,请假附件业务检测见
|
||
app/service/hrbp/oa/leave/attachment_check.py,本文件仅做导入与自测。
|
||
"""
|
||
|
||
import os
|
||
import sys
|
||
|
||
# 项目根目录 = tests 的上级目录,保证可导入 app 包
|
||
_PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||
if _PROJECT_ROOT not in sys.path:
|
||
sys.path.insert(0, _PROJECT_ROOT)
|
||
|
||
from app.service.hrbp.oa.leave.attachment_check import (
|
||
check_leave_attachment,
|
||
marriage_within_one_year,
|
||
extract_dates,
|
||
)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
# 替换为你的附件路径,修改 leave_type 即可测试不同假期
|
||
test_path = r"D:\downloads\ocr_test_01.png"
|
||
|
||
print("病假检测(开启调试)")
|
||
result = check_leave_attachment(test_path, leave_type="sick", debug=True)
|
||
print(f"病假检测结果:{result}\n")
|
||
|
||
# 测试婚假检测 + 登记日期 1 年内
|
||
# result = check_leave_attachment("结婚证图片路径", leave_type="marriage", debug=True)
|
||
# print(f"婚假检测结果:{result}")
|
||
# ok, reg_date = marriage_within_one_year("结婚证图片路径", debug=True)
|
||
# print(f"登记日期:{reg_date},1年内:{ok}")
|
||
|
||
# 测试产检假检测
|
||
# result = check_leave_attachment("产检单图片路径", leave_type="maternity", debug=True)
|
||
# print(f"产检假检测结果:{result}")
|
||
|
||
# 日期提取单测
|
||
print("日期提取测试:", extract_dates("2025年5月20日登记,出生1998年3月2日,2025-05-20"))
|