test(wave145): template_clip_converter 单测补全 +79 #1068

Closed
xiaoxia wants to merge 1 commits from test/wave145-template-clip-converter into develop
Owner

变更说明

template_clip_converter 模板片段转换器纯函数单测补全,新增79个测试用例。

测试覆盖

  • safe_parse_transition_effect (7): 枚举透传、有效/无效字符串、None、自定义默认、全枚举覆盖
  • safe_parse_clip_type (7): 同上
  • _enum_value 内部函数 (4): 枚举/字符串/数字/None
  • filter_clip_config (10): None/空配置、playback_speed边界(1.0/≠1.0/None)、字段过滤、自定义skip_keys、不可变性
  • filter_plan_config_to_template (4): None/空、运行时字段过滤、自定义skip_keys、值保持
  • clip_to_template_clip_config (13): 基础转换、各clip_type、固定时长、text→text_template、config传递/过滤、缺属性默认、无效类型安全回退
  • clips_to_template_clip_configs (2): 空列表、多片段
  • clip_config_to_snapshot (8): 枚举转字符串、空/None文案、config副本、None config、缺属性默认、字段完整性
  • clip_configs_to_snapshots (2): 空列表、多配置
  • snapshot_to_template_clip_config (7): 基础转换、缺字段默认、无效类型安全回退、config副本
  • snapshots_to_template_clip_configs (2): 空列表、多快照
  • validate_template_name (8): 正常、去空格/换行、空/None/纯空白、单字符、长名称
  • 往返转换 (2): snapshot→config→snapshot、config→snapshot→config 数据一致

本地验证

  • pytest: 79 passed
  • black: 已格式化
## 变更说明 template_clip_converter 模板片段转换器纯函数单测补全,新增79个测试用例。 ## 测试覆盖 - **safe_parse_transition_effect** (7): 枚举透传、有效/无效字符串、None、自定义默认、全枚举覆盖 - **safe_parse_clip_type** (7): 同上 - **_enum_value 内部函数** (4): 枚举/字符串/数字/None - **filter_clip_config** (10): None/空配置、playback_speed边界(1.0/≠1.0/None)、字段过滤、自定义skip_keys、不可变性 - **filter_plan_config_to_template** (4): None/空、运行时字段过滤、自定义skip_keys、值保持 - **clip_to_template_clip_config** (13): 基础转换、各clip_type、固定时长、text→text_template、config传递/过滤、缺属性默认、无效类型安全回退 - **clips_to_template_clip_configs** (2): 空列表、多片段 - **clip_config_to_snapshot** (8): 枚举转字符串、空/None文案、config副本、None config、缺属性默认、字段完整性 - **clip_configs_to_snapshots** (2): 空列表、多配置 - **snapshot_to_template_clip_config** (7): 基础转换、缺字段默认、无效类型安全回退、config副本 - **snapshots_to_template_clip_configs** (2): 空列表、多快照 - **validate_template_name** (8): 正常、去空格/换行、空/None/纯空白、单字符、长名称 - **往返转换** (2): snapshot→config→snapshot、config→snapshot→config 数据一致 ## 本地验证 - pytest: 79 passed - black: 已格式化
xiaoxia added 1 commit 2026-07-28 10:46:32 +08:00
test(wave145): add template_clip_converter unit tests (+79)
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 19s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 36s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 31s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m2s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m53s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 3m0s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 46s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m12s
AI Code Review / AI Code Review (pull_request) Successful in 5m16s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 7m20s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 6m24s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m2s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m21s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 46m17s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Successful in 7s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 42s
5baee626c9
- safe_parse_transition_effect: 枚举透传、有效/无效字符串、None、自定义默认、全枚举覆盖
- safe_parse_clip_type: 同上,7个用例
- _enum_value: 枚举/字符串/数字/None
- filter_clip_config: None、playback_speed边界(1.0/≠1.0/None)、asset_info/source_asset_id过滤、自定义skip_keys、不可变性
- filter_plan_config_to_template: None、空、运行时字段过滤、自定义skip_keys
- clip_to_template_clip_config: 基础转换、各类型、固定时长、text→text_template、config传递/过滤、缺属性默认
- clips_to_template_clip_configs: 空列表、多片段
- clip_config_to_snapshot: 枚举转字符串、空文案、None文案、config副本、None config、缺属性
- clip_configs_to_snapshots: 空列表、多配置
- snapshot_to_template_clip_config: 基础转换、缺字段默认、无效类型安全回退、config副本
- snapshots_to_template_clip_configs: 空列表、多快照
- validate_template_name: 正常、去空格/换行、空/None/纯空白、单字符、长名称
- 往返转换: snapshot→config→snapshot、config→snapshot→config 数据一致

🚀 预览环境已部署

项目 详情
PR号 #1068
预览链接 https://pr-1068.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1068 | | 预览链接 | [https://pr-1068.preview.xiaoxiajianji.com](https://pr-1068.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
Collaborator

【阻塞级判定】

  • 是否存在阻塞级问题:否
  • 阻塞级问题数量:0 个

📊 审查概览

  • 整体评价:通过
  • 建议级问题数量:0 个

🔴 阻塞级问题(必须修复)

💡 改进建议(不阻塞合并)

良好实践

  1. 测试覆盖全面:新增的测试用例覆盖了边界条件(如 None 值、空字典、缺少属性的对象)以及防御性编程场景(如 test_clip_without_attributes),有助于提升代码的鲁棒性。
  2. 关注副作用test_does_not_mutate_originaltest_config_is_copy 明确验证了函数不会修改输入参数或返回引用,这是防止数据污染的良好实践。
  3. 类型安全检查:在 TestSafeParseTransitionEffectTestSafeParseClipType 中增加了对枚举类型直通的测试,确保了类型处理的正确性。
  4. 代码可读性:使用了 SimpleNamespace 替代原有的 FakeClip 数据类,减少了样板代码,使测试逻辑更加聚焦。

🤖 由 AI 代码审查机器人自动生成 | 2026-07-28 03:39:25 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:通过 - 建议级问题数量:0 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 无 ### ✅ 良好实践 1. **测试覆盖全面**:新增的测试用例覆盖了边界条件(如 `None` 值、空字典、缺少属性的对象)以及防御性编程场景(如 `test_clip_without_attributes`),有助于提升代码的鲁棒性。 2. **关注副作用**:`test_does_not_mutate_original` 和 `test_config_is_copy` 明确验证了函数不会修改输入参数或返回引用,这是防止数据污染的良好实践。 3. **类型安全检查**:在 `TestSafeParseTransitionEffect` 和 `TestSafeParseClipType` 中增加了对枚举类型直通的测试,确保了类型处理的正确性。 4. **代码可读性**:使用了 `SimpleNamespace` 替代原有的 `FakeClip` 数据类,减少了样板代码,使测试逻辑更加聚焦。 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-07-28 03:39:25 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
xiaoxia closed this pull request 2026-07-28 12:23:54 +08:00

🗑️ 预览环境已清理

PR #1068 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #1068 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Some checks are pending
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 19s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 36s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 31s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m2s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m53s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 3m0s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 46s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m12s
AI Code Review / AI Code Review (pull_request) Successful in 5m16s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 7m20s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 6m24s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m2s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m21s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 46m17s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Successful in 7s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 42s

Pull request closed

Sign in to join this conversation.