# 值错误：id 为 'case_1' 的重复参数集

- **ID:** `python/pytest-parametrize-id-collision`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

为多个参数化用例使用相同的 ID，而没有唯一 ID。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (99% 成功率)
   ```
   @pytest.mark.parametrize('arg', [1, 2], ids=['case_1', 'case_2'])
   ```
2. **** (95% 成功率)
   ```
   def id_func(val):
    return f'case_{val}'
@pytest.mark.parametrize('arg', [1, 2], ids=id_func)
   ```

## 无效尝试

- **** — Pytest will auto-generate IDs, but they may not be descriptive. (40% 失败率)
- **** — This still causes duplicate IDs. (100% 失败率)
