PayrollManagementSystem/backend/tests/unit
liuwenxin 7a99994d17 refactor(m3): calc_receipt 五段拆分——218 行收敛为编排 + 私有函数
code-review 约定合规项(CLAUDE.md「单一职责 ≤50 行」):原 218 行单函数
把锁行校验、模式预处理、输入装载、逐行折算、计提组成、落库全部内联,
待澄清答复回填时改动回归面大。按原执行顺序拆为四段私有函数 + 两个
冻结 dataclass(_Conversion/_Amounts),主函数只做编排;行为零变化
(M3 全部用例原样通过):

- _load_and_guard:锁行 + 模式校验 + 月结锁定拦截 + 业务归属校验
- _prepare_mode:重算作废旧版本 / 首算判一次性计提(进度登记提前返回)
- _load_shipment / _load_person / _load_items:输入装载三查
- _convert_items → _Conversion:逐行折算(行级阈值/缺成本标记/行级明细)
- _compose_amounts → _Amounts:比例分派 → 绩效 → 抵顶 → 权重 → 应付
- _persist_ledger:落台账行 + 首算 CAS
- 局部 q2 提为模块级 _q2(新增单测锁定 HALF_UP:2.345→2.35,
  缺省银行家舍入会得 2.34)

验证:全量 780 passed;type-check 绿

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-19 12:25:36 +08:00
..
__init__.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_audit_serialization.py fix(system): code-review 15 项修复(预览基数/维度校验/脱敏穿透/并发版本号等) 2026-10-13 02:28:20 +08:00
test_audit_service.py feat(system): 完成后端系统管理(审计/角色/操作日志/日志查询) 2026-10-10 16:28:04 +08:00
test_auth_schemas.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_calc_helpers.py refactor(m3): calc_receipt 五段拆分——218 行收敛为编排 + 私有函数 2026-10-19 12:25:36 +08:00
test_captcha.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_config.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_exception_handlers.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_formula.py feat(formula): 首日计提比例取整 10‰(#14 答复——图示口径覆盖公式) 2026-10-19 11:40:07 +08:00
test_jwt.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_log_schemas.py feat(system): 完成后端系统管理(审计/角色/操作日志/日志查询) 2026-10-10 16:28:04 +08:00
test_logging.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_login_limiter.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_models.py feat(migration): V7 核算台账/月结/调整单四表与核算纯函数 2026-10-16 16:32:32 +08:00
test_param_registry.py feat(migration): V8 业务答复口径落实——审批开关默认开启、撤试用期统一参数、经理基数开关、台账分摊唯一键 2026-10-19 11:09:05 +08:00
test_param_snapshot.py feat(system): 计提参数版本管理、变更留痕与计算预览接口 2026-10-12 20:24:17 +08:00
test_product_schema.py fix(product): 删除引用保护/单价小数位校验,IntegrityError 全局兜底转 400 2026-10-14 18:48:32 +08:00
test_response.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_role_schemas.py feat(system): 完成后端系统管理(审计/角色/操作日志/日志查询) 2026-10-10 16:28:04 +08:00
test_secondary_allocation_schema.py feat(allocation): 二次分配方案录入/替换/终态门槛(分摊计算待澄清另批) 2026-10-15 18:31:27 +08:00
test_security.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00
test_settlement_helpers.py fix(m3): code-review P1——锁定不变量、入结回填与双轨漂移 2026-10-19 11:59:49 +08:00
test_token_blacklist.py chore: 初始化项目结构与登录鉴权模块 2026-10-09 18:46:36 +08:00